diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0779e8a..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = true # Note: this disables using two spaces to force a hard line break, which is permitted in Markdown. As we don't typically follow that practice (TMK), we should be safe to automatically trim. - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 51766c5..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-12-23T02:01:52.531Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 4ee6a31..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/streams/node) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index ccaa93b..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/streams/node) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 666d0fa..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '27 15 * * 0' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var streams = require( '@stdlib/streams-node' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### streams @@ -111,11 +117,21 @@ The package contains the following streams: -```javascript -var getKeys = require( '@stdlib/utils-keys' ); -var streams = require( '@stdlib/streams-node' ); +```html + + + + + + + + ```
@@ -204,37 +220,37 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/streams/node/debug-sink]: https://github.com/stdlib-js/streams-node-debug-sink +[@stdlib/streams/node/debug-sink]: https://github.com/stdlib-js/streams-node-debug-sink/tree/umd -[@stdlib/streams/node/debug]: https://github.com/stdlib-js/streams-node-debug +[@stdlib/streams/node/debug]: https://github.com/stdlib-js/streams-node-debug/tree/umd -[@stdlib/streams/node/empty]: https://github.com/stdlib-js/streams-node-empty +[@stdlib/streams/node/empty]: https://github.com/stdlib-js/streams-node-empty/tree/umd -[@stdlib/streams/node/from-array]: https://github.com/stdlib-js/streams-node-from-array +[@stdlib/streams/node/from-array]: https://github.com/stdlib-js/streams-node-from-array/tree/umd -[@stdlib/streams/node/from-circular-array]: https://github.com/stdlib-js/streams-node-from-circular-array +[@stdlib/streams/node/from-circular-array]: https://github.com/stdlib-js/streams-node-from-circular-array/tree/umd -[@stdlib/streams/node/from-constant]: https://github.com/stdlib-js/streams-node-from-constant +[@stdlib/streams/node/from-constant]: https://github.com/stdlib-js/streams-node-from-constant/tree/umd -[@stdlib/streams/node/from-iterator]: https://github.com/stdlib-js/streams-node-from-iterator +[@stdlib/streams/node/from-iterator]: https://github.com/stdlib-js/streams-node-from-iterator/tree/umd -[@stdlib/streams/node/from-strided-array]: https://github.com/stdlib-js/streams-node-from-strided-array +[@stdlib/streams/node/from-strided-array]: https://github.com/stdlib-js/streams-node-from-strided-array/tree/umd -[@stdlib/streams/node/inspect-sink]: https://github.com/stdlib-js/streams-node-inspect-sink +[@stdlib/streams/node/inspect-sink]: https://github.com/stdlib-js/streams-node-inspect-sink/tree/umd -[@stdlib/streams/node/inspect]: https://github.com/stdlib-js/streams-node-inspect +[@stdlib/streams/node/inspect]: https://github.com/stdlib-js/streams-node-inspect/tree/umd -[@stdlib/streams/node/join]: https://github.com/stdlib-js/streams-node-join +[@stdlib/streams/node/join]: https://github.com/stdlib-js/streams-node-join/tree/umd -[@stdlib/streams/node/split]: https://github.com/stdlib-js/streams-node-split +[@stdlib/streams/node/split]: https://github.com/stdlib-js/streams-node-split/tree/umd -[@stdlib/streams/node/stderr]: https://github.com/stdlib-js/streams-node-stderr +[@stdlib/streams/node/stderr]: https://github.com/stdlib-js/streams-node-stderr/tree/umd -[@stdlib/streams/node/stdin]: https://github.com/stdlib-js/streams-node-stdin +[@stdlib/streams/node/stdin]: https://github.com/stdlib-js/streams-node-stdin/tree/umd -[@stdlib/streams/node/stdout]: https://github.com/stdlib-js/streams-node-stdout +[@stdlib/streams/node/stdout]: https://github.com/stdlib-js/streams-node-stdout/tree/umd -[@stdlib/streams/node/transform]: https://github.com/stdlib-js/streams-node-transform +[@stdlib/streams/node/transform]: https://github.com/stdlib-js/streams-node-transform/tree/umd diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/branches.md b/branches.md deleted file mode 100644 index aac1126..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/streams/node" -%% click B href "https://github.com/stdlib-js/streams-node/tree/main" -%% click C href "https://github.com/stdlib-js/streams-node/tree/production" -%% click D href "https://github.com/stdlib-js/streams-node/tree/esm" -%% click E href "https://github.com/stdlib-js/streams-node/tree/deno" -%% click F href "https://github.com/stdlib-js/streams-node/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/streams/node -[production-url]: https://github.com/stdlib-js/streams-node/tree/production -[deno-url]: https://github.com/stdlib-js/streams-node/tree/deno -[deno-readme]: https://github.com/stdlib-js/streams-node/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/streams-node/tree/umd -[umd-readme]: https://github.com/stdlib-js/streams-node/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/streams-node/tree/esm -[esm-readme]: https://github.com/stdlib-js/streams-node/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..87cb2f1 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).streams=t()}(this,(function(){"use strict";var e="function"==typeof Object.defineProperty?Object.defineProperty:null;var t=Object.defineProperty;function r(e){return"number"==typeof e}function n(e){var t,r="";for(t=0;t0&&(t-=1),n=i.toExponential(t)):n=i.toPrecision(e.precision),e.alternate||(n=h.call(n,y,"$1e"),n=h.call(n,m,"e"),n=h.call(n,b,""));break;default:throw new Error("invalid double notation. Value: "+e.specifier)}return n=h.call(n,c,"e+0$1"),n=h.call(n,d,"e-0$1"),e.alternate&&(n=h.call(n,p,"$1."),n=h.call(n,g,"$1.e")),i>=0&&e.sign&&(n=e.sign+n),n=e.specifier===f.call(e.specifier)?f.call(n):l.call(n)}function v(e){var t,r="";for(t=0;t127)throw new Error("invalid character code. Value: "+n.arg);n.arg=j(a)?String(n.arg):_(a)}break;case"e":case"E":case"f":case"F":case"g":case"G":t||(n.precision=6),n.arg=w(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=i(n.arg,n.width||n.precision,n.padRight):n.width&&(n.arg=(c=n.arg,d=n.width,p=n.padRight,g=void 0,(g=d-c.length)<0?c:c=p?c+v(g):v(g)+c)),u+=n.arg||"",l+=1}return u}var S=/%(?:([1-9]\d*)\$)?([0 +\-#]*)(\*|\d+)?(?:(\.)(\*|\d+)?)?[hlL]?([%A-Za-z])/g;function T(e){var t={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]&&(t.precision="1"),t}function k(e){var t,r,n,i;for(r=[],i=0,n=S.exec(e);n;)(t=e.slice(i,S.lastIndex-n[0].length)).length&&r.push(t),r.push(T(n)),i=S.lastIndex,n=S.exec(e);return(t=e.slice(i)).length&&r.push(t),r}function R(e){var t,r;if("string"!=typeof e)throw new TypeError(R("invalid argument. First argument must be a string. Value: `%s`.",e));for(t=[k(e)],r=1;r0&&a.length>i){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=a.length,s=u,"function"==typeof console.warn?console.warn(s):console.log(s)}}else a=o[t]=r,++e._eventsCount;return e}function H(e,t,r){var n=!1;function i(){e.removeListener(t,i),n||(n=!0,r.apply(e,arguments))}return i.listener=r,i}function J(e){var t=this._events;if(t){var r=t[e];if("function"==typeof r)return 1;if(r)return r.length}return 0}function q(e,t){for(var r=new Array(t);t--;)r[t]=e[t];return r}U.prototype=Object.create(null),D.EventEmitter=D,D.usingDomains=!1,D.prototype.domain=void 0,D.prototype._events=void 0,D.prototype._maxListeners=void 0,D.defaultMaxListeners=10,D.init=function(){this.domain=null,D.usingDomains&&undefined.active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new U,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},D.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},D.prototype.getMaxListeners=function(){return F(this)},D.prototype.emit=function(e){var t,r,n,i,o,a,s,u="error"===e;if(a=this._events)u=u&&null==a.error;else if(!u)return!1;if(s=this.domain,u){if(t=arguments[1],!s){if(t instanceof Error)throw t;var l=new Error('Uncaught, unspecified "error" event. ('+t+")");throw l.context=t,l}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=s,t.domainThrown=!1,s.emit("error",t),!1}if(!(r=a[e]))return!1;var f="function"==typeof r;switch(n=arguments.length){case 1:!function(e,t,r){if(t)e.call(r);else for(var n=e.length,i=q(e,n),o=0;o0;)if(r[o]===t||r[o].listener&&r[o].listener===t){a=r[o].listener,i=o;break}if(i<0)return this;if(1===r.length){if(r[0]=void 0,0==--this._eventsCount)return this._events=new U,this;delete n[e]}else!function(e,t){for(var r=t,n=r+1,i=e.length;n0?Reflect.ownKeys(this._events):[]};var $="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},G=[],Z=[],X="undefined"!=typeof Uint8Array?Uint8Array:Array,K=!1;function Q(){K=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)G[t]=e[t],Z[e.charCodeAt(t)]=t;Z["-".charCodeAt(0)]=62,Z["_".charCodeAt(0)]=63}function ee(e,t,r){for(var n,i,o=[],a=t;a>18&63]+G[i>>12&63]+G[i>>6&63]+G[63&i]);return o.join("")}function te(e){var t;K||Q();for(var r=e.length,n=r%3,i="",o=[],a=16383,s=0,u=r-n;su?u:s+a));return 1===n?(t=e[r-1],i+=G[t>>2],i+=G[t<<4&63],i+="=="):2===n&&(t=(e[r-2]<<8)+e[r-1],i+=G[t>>10],i+=G[t>>4&63],i+=G[t<<2&63],i+="="),o.push(i),o.join("")}function re(e,t,r,n,i){var o,a,s=8*i-n-1,u=(1<>1,f=-7,h=r?i-1:0,c=r?-1:1,d=e[t+h];for(h+=c,o=d&(1<<-f)-1,d>>=-f,f+=s;f>0;o=256*o+e[t+h],h+=c,f-=8);for(a=o&(1<<-f)-1,o>>=-f,f+=n;f>0;a=256*a+e[t+h],h+=c,f-=8);if(0===o)o=1-l;else{if(o===u)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,n),o-=l}return(d?-1:1)*a*Math.pow(2,o-n)}function ne(e,t,r,n,i,o){var a,s,u,l=8*o-i-1,f=(1<>1,c=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=f):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+h>=1?c/u:c*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=f?(s=0,a=f):a+h>=1?(s=(t*u-1)*Math.pow(2,i),a+=h):(s=t*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;e[r+d]=255&s,d+=p,s/=256,i-=8);for(a=a<0;e[r+d]=255&a,d+=p,a/=256,l-=8);e[r+d-p]|=128*g}var ie={}.toString,oe=Array.isArray||function(e){return"[object Array]"==ie.call(e)};le.TYPED_ARRAY_SUPPORT=void 0===$.TYPED_ARRAY_SUPPORT||$.TYPED_ARRAY_SUPPORT;var ae=se();function se(){return le.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function ue(e,t){if(se()=se())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+se().toString(16)+" bytes");return 0|e}function ge(e){return!(null==e||!e._isBuffer)}function be(e,t){if(ge(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return Fe(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Ye(e).length;default:if(n)return Fe(e).length;t=(""+t).toLowerCase(),n=!0}}function me(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return Le(this,t,r);case"utf8":case"utf-8":return ke(this,t,r);case"ascii":return xe(this,t,r);case"latin1":case"binary":return Ae(this,t,r);case"base64":return Te(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ce(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function ye(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function we(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=le.from(t,n)),ge(t))return 0===t.length?-1:ve(e,t,r,n,i);if("number"==typeof t)return t&=255,le.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):ve(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function ve(e,t,r,n,i){var o,a=1,s=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,r/=2}function l(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var f=-1;for(o=r;os&&(r=s-u),o=r;o>=0;o--){for(var h=!0,c=0;ci&&(n=i):n=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;a>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function Te(e,t,r){return 0===t&&r===e.length?te(e):te(e.slice(t,r))}function ke(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i239?4:l>223?3:l>191?2:1;if(i+h<=r)switch(h){case 1:l<128&&(f=l);break;case 2:128==(192&(o=e[i+1]))&&(u=(31&l)<<6|63&o)>127&&(f=u);break;case 3:o=e[i+1],a=e[i+2],128==(192&o)&&128==(192&a)&&(u=(15&l)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(f=u);break;case 4:o=e[i+1],a=e[i+2],s=e[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(u=(15&l)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(f=u)}null===f?(f=65533,h=1):f>65535&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|1023&f),n.push(f),i+=h}return function(e){var t=e.length;if(t<=Re)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),""},le.prototype.compare=function(e,t,r,n,i){if(!ge(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(t>>>=0),s=Math.min(o,a),u=this.slice(n,i),l=e.slice(t,r),f=0;fi)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return _e(this,e,t,r);case"utf8":case"utf-8":return Ee(this,e,t,r);case"ascii":return je(this,e,t,r);case"latin1":case"binary":return Me(this,e,t,r);case"base64":return Oe(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Se(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},le.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Re=4096;function xe(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;in)&&(r=n);for(var i="",o=t;or)throw new RangeError("Trying to access beyond buffer length")}function We(e,t,r,n,i,o){if(!ge(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function Ve(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-r,2);i>>8*(n?i:1-i)}function Ie(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-r,4);i>>8*(n?i:3-i)&255}function Be(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function ze(e,t,r,n,i){return i||Be(e,0,r,4),ne(e,t,r,n,23,4),r+4}function Ne(e,t,r,n,i){return i||Be(e,0,r,8),ne(e,t,r,n,52,8),r+8}le.prototype.slice=function(e,t){var r,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t0&&(i*=256);)n+=this[e+--t]*i;return n},le.prototype.readUInt8=function(e,t){return t||Pe(e,1,this.length),this[e]},le.prototype.readUInt16LE=function(e,t){return t||Pe(e,2,this.length),this[e]|this[e+1]<<8},le.prototype.readUInt16BE=function(e,t){return t||Pe(e,2,this.length),this[e]<<8|this[e+1]},le.prototype.readUInt32LE=function(e,t){return t||Pe(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},le.prototype.readUInt32BE=function(e,t){return t||Pe(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},le.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||Pe(e,t,this.length);for(var n=this[e],i=1,o=0;++o=(i*=128)&&(n-=Math.pow(2,8*t)),n},le.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||Pe(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},le.prototype.readInt8=function(e,t){return t||Pe(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},le.prototype.readInt16LE=function(e,t){t||Pe(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},le.prototype.readInt16BE=function(e,t){t||Pe(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},le.prototype.readInt32LE=function(e,t){return t||Pe(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},le.prototype.readInt32BE=function(e,t){return t||Pe(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},le.prototype.readFloatLE=function(e,t){return t||Pe(e,4,this.length),re(this,e,!0,23,4)},le.prototype.readFloatBE=function(e,t){return t||Pe(e,4,this.length),re(this,e,!1,23,4)},le.prototype.readDoubleLE=function(e,t){return t||Pe(e,8,this.length),re(this,e,!0,52,8)},le.prototype.readDoubleBE=function(e,t){return t||Pe(e,8,this.length),re(this,e,!1,52,8)},le.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||We(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o=0&&(o*=256);)this[t+i]=e/o&255;return t+r},le.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||We(this,e,t,1,255,0),le.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},le.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||We(this,e,t,2,65535,0),le.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):Ve(this,e,t,!0),t+2},le.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||We(this,e,t,2,65535,0),le.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):Ve(this,e,t,!1),t+2},le.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||We(this,e,t,4,4294967295,0),le.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):Ie(this,e,t,!0),t+4},le.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||We(this,e,t,4,4294967295,0),le.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Ie(this,e,t,!1),t+4},le.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);We(this,e,t,r,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+r},le.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);We(this,e,t,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+r},le.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||We(this,e,t,1,127,-128),le.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},le.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||We(this,e,t,2,32767,-32768),le.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):Ve(this,e,t,!0),t+2},le.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||We(this,e,t,2,32767,-32768),le.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):Ve(this,e,t,!1),t+2},le.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||We(this,e,t,4,2147483647,-2147483648),le.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):Ie(this,e,t,!0),t+4},le.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||We(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),le.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Ie(this,e,t,!1),t+4},le.prototype.writeFloatLE=function(e,t,r){return ze(this,e,t,!0,r)},le.prototype.writeFloatBE=function(e,t,r){return ze(this,e,t,!1,r)},le.prototype.writeDoubleLE=function(e,t,r){return Ne(this,e,t,!0,r)},le.prototype.writeDoubleBE=function(e,t,r){return Ne(this,e,t,!1,r)},le.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--i)e[i+t]=this[i+r];else if(o<1e3||!le.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function Ye(e){return function(e){var t,r,n,i,o,a;K||Q();var s=e.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===e[s-2]?2:"="===e[s-1]?1:0,a=new X(3*s/4-o),n=o>0?s-4:s;var u=0;for(t=0,r=0;t>16&255,a[u++]=i>>8&255,a[u++]=255&i;return 2===o?(i=Z[e.charCodeAt(t)]<<2|Z[e.charCodeAt(t+1)]>>4,a[u++]=255&i):1===o&&(i=Z[e.charCodeAt(t)]<<10|Z[e.charCodeAt(t+1)]<<4|Z[e.charCodeAt(t+2)]>>2,a[u++]=i>>8&255,a[u++]=255&i),a}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(Ue,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function He(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function Je(e){return null!=e&&(!!e._isBuffer||qe(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&qe(e.slice(0,0))}(e))}function qe(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var $e=Object.freeze({__proto__:null,Buffer:le,INSPECT_MAX_BYTES:50,SlowBuffer:function(e){return+e!=e&&(e=0),le.alloc(+e)},isBuffer:Je,kMaxLength:ae});function Ge(){throw new Error("setTimeout has not been defined")}function Ze(){throw new Error("clearTimeout has not been defined")}var Xe=Ge,Ke=Ze;function Qe(e){if(Xe===setTimeout)return setTimeout(e,0);if((Xe===Ge||!Xe)&&setTimeout)return Xe=setTimeout,setTimeout(e,0);try{return Xe(e,0)}catch(t){try{return Xe.call(null,e,0)}catch(t){return Xe.call(this,e,0)}}}"function"==typeof $.setTimeout&&(Xe=setTimeout),"function"==typeof $.clearTimeout&&(Ke=clearTimeout);var et,tt=[],rt=!1,nt=-1;function it(){rt&&et&&(rt=!1,et.length?tt=et.concat(tt):nt=-1,tt.length&&ot())}function ot(){if(!rt){var e=Qe(it);rt=!0;for(var t=tt.length;t;){for(et=tt,tt=[];++nt1)for(var r=1;r=i)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return e}})),a=n[r];r=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),qt(t)?r.showHidden=t:t&&function(e,t){if(!t||!Kt(t))return e;var r=Object.keys(t),n=r.length;for(;n--;)e[r[n]]=t[r[n]]}(r,t),Zt(r.showHidden)&&(r.showHidden=!1),Zt(r.depth)&&(r.depth=2),Zt(r.colors)&&(r.colors=!1),Zt(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=Dt),Yt(r,e,r.depth)}function Dt(e,t){var r=Ut.styles[t];return r?"["+Ut.colors[r][0]+"m"+e+"["+Ut.colors[r][1]+"m":e}function Ft(e,t){return e}function Yt(e,t,r){if(e.customInspect&&t&&tr(t.inspect)&&t.inspect!==Ut&&(!t.constructor||t.constructor.prototype!==t)){var n=t.inspect(r,e);return Gt(n)||(n=Yt(e,n,r)),n}var i=function(e,t){if(Zt(t))return e.stylize("undefined","undefined");if(Gt(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if(n=t,"number"==typeof n)return e.stylize(""+t,"number");var n;if(qt(t))return e.stylize(""+t,"boolean");if($t(t))return e.stylize("null","null")}(e,t);if(i)return i;var o=Object.keys(t),a=function(e){var t={};return e.forEach((function(e,r){t[e]=!0})),t}(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(t)),er(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return Ht(t);if(0===o.length){if(tr(t)){var s=t.name?": "+t.name:"";return e.stylize("[Function"+s+"]","special")}if(Xt(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(Qt(t))return e.stylize(Date.prototype.toString.call(t),"date");if(er(t))return Ht(t)}var u,l,f="",h=!1,c=["{","}"];(u=t,Array.isArray(u)&&(h=!0,c=["[","]"]),tr(t))&&(f=" [Function"+(t.name?": "+t.name:"")+"]");return Xt(t)&&(f=" "+RegExp.prototype.toString.call(t)),Qt(t)&&(f=" "+Date.prototype.toUTCString.call(t)),er(t)&&(f=" "+Ht(t)),0!==o.length||h&&0!=t.length?r<0?Xt(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),l=h?function(e,t,r,n,i){for(var o=[],a=0,s=t.length;a60)return r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1];return r[0]+t+" "+e.join(", ")+" "+r[1]}(l,f,c)):c[0]+f+c[1]}function Ht(e){return"["+Error.prototype.toString.call(e)+"]"}function Jt(e,t,r,n,i,o){var a,s,u;if((u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?s=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(s=e.stylize("[Setter]","special")),nr(n,i)||(a="["+i+"]"),s||(e.seen.indexOf(u.value)<0?(s=$t(r)?Yt(e,u.value,null):Yt(e,u.value,r-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+s.split("\n").map((function(e){return" "+e})).join("\n")):s=e.stylize("[Circular]","special")),Zt(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function qt(e){return"boolean"==typeof e}function $t(e){return null===e}function Gt(e){return"string"==typeof e}function Zt(e){return void 0===e}function Xt(e){return Kt(e)&&"[object RegExp]"===rr(e)}function Kt(e){return"object"==typeof e&&null!==e}function Qt(e){return Kt(e)&&"[object Date]"===rr(e)}function er(e){return Kt(e)&&("[object Error]"===rr(e)||e instanceof Error)}function tr(e){return"function"==typeof e}function rr(e){return Object.prototype.toString.call(e)}function nr(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function ir(){this.head=null,this.tail=null,this.length=0}Ut.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},Ut.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},ir.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},ir.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},ir.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},ir.prototype.clear=function(){this.head=this.tail=null,this.length=0},ir.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r},ir.prototype.concat=function(e){if(0===this.length)return le.alloc(0);if(1===this.length)return this.head.data;for(var t=le.allocUnsafe(e>>>0),r=this.head,n=0;r;)r.data.copy(t,n),n+=r.data.length,r=r.next;return t};var or=le.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function ar(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),function(e){if(e&&!or(e))throw new Error("Unknown encoding: "+e)}(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=ur;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=lr;break;default:return void(this.write=sr)}this.charBuffer=new le(6),this.charReceived=0,this.charLength=0}function sr(e){return e.toString(this.encoding)}function ur(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function lr(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}ar.prototype.write=function(e){for(var t="";this.charLength;){var r=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,r),this.charReceived+=r,this.charReceived=55296&&i<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var n=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,n),n-=this.charReceived);var i;n=(t+=e.toString(this.encoding,0,n)).length-1;if((i=t.charCodeAt(n))>=55296&&i<=56319){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),e.copy(this.charBuffer,0,0,o),t.substring(0,n)}return t},ar.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var r=e[e.length-t];if(1==t&&r>>5==6){this.charLength=2;break}if(t<=2&&r>>4==14){this.charLength=3;break}if(t<=3&&r>>3==30){this.charLength=4;break}}this.charReceived=t},ar.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var r=this.charReceived,n=this.charBuffer,i=this.encoding;t+=n.slice(0,r).toString(i)}return t},cr.ReadableState=hr;var fr=function(e){if(Zt(zt)&&(zt=Ct.env.NODE_DEBUG||""),e=e.toUpperCase(),!Nt[e])if(new RegExp("\\b"+e+"\\b","i").test(zt)){Nt[e]=function(){var t=It.apply(null,arguments);console.error("%s %d: %s",e,0,t)}}else Nt[e]=function(){};return Nt[e]}("stream");function hr(e,t){e=e||{},this.objectMode=!!e.objectMode,t instanceof Nr&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var r=e.highWaterMark,n=this.objectMode?16:16384;this.highWaterMark=r||0===r?r:n,this.highWaterMark=~~this.highWaterMark,this.buffer=new ir,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(this.decoder=new ar(e.encoding),this.encoding=e.encoding)}function cr(e){if(!(this instanceof cr))return new cr(e);this._readableState=new hr(e,this),this.readable=!0,e&&"function"==typeof e.read&&(this._read=e.read),D.call(this)}function dr(e,t,r,n,i){var o=function(e,t){var r=null;le.isBuffer(t)||"string"==typeof t||null==t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk"));return r}(t,r);if(o)e.emit("error",o);else if(null===r)t.reading=!1,function(e,t){if(t.ended)return;if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,br(e)}(e,t);else if(t.objectMode||r&&r.length>0)if(t.ended&&!i){var a=new Error("stream.push() after EOF");e.emit("error",a)}else if(t.endEmitted&&i){var s=new Error("stream.unshift() after end event");e.emit("error",s)}else{var u;!t.decoder||i||n||(r=t.decoder.write(r),u=!t.objectMode&&0===r.length),i||(t.reading=!1),u||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,i?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&br(e))),function(e,t){t.readingMore||(t.readingMore=!0,at(yr,e,t))}(e,t)}else i||(t.reading=!1);return function(e){return!e.ended&&(e.needReadable||e.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=pr?e=pr:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function br(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(fr("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?at(mr,e):mr(e))}function mr(e){fr("emit readable"),e.emit("readable"),_r(e)}function yr(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=function(e,t,r){var n;eo.length?o.length:e;if(a===o.length?i+=o:i+=o.slice(0,e),0===(e-=a)){a===o.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(a));break}++n}return t.length-=n,i}(e,t):function(e,t){var r=le.allocUnsafe(e),n=t.head,i=1;n.data.copy(r),e-=n.data.length;for(;n=n.next;){var o=n.data,a=e>o.length?o.length:e;if(o.copy(r,r.length-e,0,a),0===(e-=a)){a===o.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(a));break}++i}return t.length-=i,r}(e,t);return n}(e,t.buffer,t.decoder),r);var r}function jr(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,at(Mr,t,e))}function Mr(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function Or(e,t){for(var r=0,n=e.length;r=t.highWaterMark||t.ended))return fr("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?jr(this):br(this),null;if(0===(e=gr(e,t))&&t.ended)return 0===t.length&&jr(this),null;var n,i=t.needReadable;return fr("need readable",i),(0===t.length||t.length-e0?Er(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&jr(this)),null!==n&&this.emit("data",n),n},cr.prototype._read=function(e){this.emit("error",new Error("not implemented"))},cr.prototype.pipe=function(e,t){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=e;break;case 1:n.pipes=[n.pipes,e];break;default:n.pipes.push(e)}n.pipesCount+=1,fr("pipe count=%d opts=%j",n.pipesCount,t);var i=!t||!1!==t.end?a:l;function o(e){fr("onunpipe"),e===r&&l()}function a(){fr("onend"),e.end()}n.endEmitted?at(i):r.once("end",i),e.on("unpipe",o);var s=function(e){return function(){var t=e._readableState;fr("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&e.listeners("data").length&&(t.flowing=!0,_r(e))}}(r);e.on("drain",s);var u=!1;function l(){fr("cleanup"),e.removeListener("close",d),e.removeListener("finish",p),e.removeListener("drain",s),e.removeListener("error",c),e.removeListener("unpipe",o),r.removeListener("end",a),r.removeListener("end",l),r.removeListener("data",h),u=!0,!n.awaitDrain||e._writableState&&!e._writableState.needDrain||s()}var f=!1;function h(t){fr("ondata"),f=!1,!1!==e.write(t)||f||((1===n.pipesCount&&n.pipes===e||n.pipesCount>1&&-1!==Or(n.pipes,e))&&!u&&(fr("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,f=!0),r.pause())}function c(t){var r;fr("onerror",t),g(),e.removeListener("error",c),0===(r="error",e.listeners(r).length)&&e.emit("error",t)}function d(){e.removeListener("finish",p),g()}function p(){fr("onfinish"),e.removeListener("close",d),g()}function g(){fr("unpipe"),r.unpipe(e)}return r.on("data",h),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",c),e.once("close",d),e.once("finish",p),e.emit("pipe",r),n.flowing||(fr("pipe resume"),r.resume()),e},cr.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this)),this;if(!e){var r=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Rr.prototype._write=function(e,t,r){r(new Error("not implemented"))},Rr.prototype._writev=null,Rr.prototype.end=function(e,t,r){var n=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||function(e,t,r){t.ending=!0,Wr(e,t),r&&(t.finished?at(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,n,r)},Wt(Nr,cr);for(var Ir=Object.keys(Rr.prototype),Br=0;BrKn&&ei(e)}function ri(e){return Un(e)&&ti(e)}function ni(e){return Hn(e)&&ti(e.valueOf())}function ii(e){return ri(e)||ni(e)}z(ii,"isPrimitive",ri),z(ii,"isObject",ni);var oi=Object.prototype.propertyIsEnumerable;var ai=!oi.call("beep","0");function si(e,t){var r;return null!=e&&(!(r=oi.call(e,t))&&ai&&Nn(e)?!$n(t=+t)&&ri(t)&&t>=0&&t=0&&e.length<=4294967295&&tn(e,"callee")&&!si(e,"callee")};var li=ui,fi=Array.prototype.slice;var hi=si((function(){}),"prototype"),ci=!si({toString:null},"toString"),di=9007199254740991;function pi(e){return"object"==typeof e&&null!==e&&"number"==typeof e.length&&ei(e.length)&&e.length>=0&&e.length<=di}function gi(e,t,r){var n,i;if(!pi(e)&&!Vn(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(!ri(r))throw new TypeError(R("invalid argument. Third argument must be an integer. Value: `%s`.",r));if(r>=0){if(r>=n)return-1;i=r}else(i=n+r)<0&&(i=0)}else i=0;if(Zn(t)){for(;i0&&!tn(e,"0"))for(s=0;s=0}function Gi(e){return Hn(e)&&e.valueOf()>=0}function Zi(e){return $i(e)||Gi(e)}z(Zi,"isPrimitive",$i),z(Zi,"isObject",Gi);var Xi=N(Object.freeze({__proto__:null,default:()=>()=>{}})),Ki=Xi("inspect-stream"),Qi=$r.Transform;function eo(e,t){var r,n,i;if(!(this instanceof eo))return arguments.length>1?new eo(e,t):new eo(e);if(n=Ai({},Ui),arguments.length>1){if(r=t,i=function(e,t){return qi(t)?tn(t,"objectMode")&&(e.objectMode=t.objectMode,!Zr(e.objectMode))?new TypeError(R("invalid option. `%s` option must be a boolean. Option: `%s`.","objectMode",e.objectMode)):tn(t,"readableObjectMode")&&(e.readableObjectMode=t.readableObjectMode,!Zr(e.readableObjectMode))?new TypeError(R("invalid option. `%s` option must be a boolean. Option: `%s`.","readableObjectMode",e.readableObjectMode)):tn(t,"allowHalfOpen")&&(e.allowHalfOpen=t.allowHalfOpen,!Zr(e.allowHalfOpen))?new TypeError(R("invalid option. `%s` option must be a boolean. Option: `%s`.","allowHalfOpen",e.allowHalfOpen)):tn(t,"highWaterMark")&&(e.highWaterMark=t.highWaterMark,!$i(e.highWaterMark))?new TypeError(R("invalid option. `%s` option must be a nonnegative number. Option: `%s`.","highWaterMark",e.highWaterMark)):null:new TypeError(R("invalid argument. Options argument must be an object. Value: `%s`.",t))}(n,e),i)throw i}else r=e;if(!kn(r))throw new TypeError(R("invalid argument. Callback argument must be a function. Value: `%s`.",r));return n.writableObjectMode=!0,Ki("Creating a transform stream configured with the following options: %s.",JSON.stringify(n)),Qi.call(this,n),Ii(this,"_destroyed",!1),Ii(this,"_idx",-1),z(this,"_inspect",r),this}Vi(eo,Qi),z(eo.prototype,"_transform",(function(e,t,r){this._idx+=1,Ki("Received a new chunk. Chunk: %s. Encoding: %s. Index: %d.",e.toString(),t,this._idx),this._inspect.call(null,e,this._idx),this.push(e),r()})),z(eo.prototype,"_flush",(function(e){Ki("Flushing the stream..."),e()})),z(eo.prototype,"destroy",(function(e){var t;return this._destroyed?(Ki("Attempted to destroy an already destroyed stream."),this):(t=this,this._destroyed=!0,Ni((function(){e&&(Ki("Stream was destroyed due to an error. Error: %s.",JSON.stringify(e)),t.emit("error",e));Ki("Closing the stream..."),t.emit("close")})),this)})),z(eo,"objectMode",(function(e,t){var r,n;if(arguments.length>1){if(!qi(e))throw new TypeError(R("invalid argument. Options argument must be an object. Value: `%s`.",e));r=Ai({},e),n=t}else r={},n=e;return r.objectMode=!0,new eo(r,n)})),z(eo,"factory",(function(e){var t;if(arguments.length){if(!qi(e))throw new TypeError(R("invalid argument. Options argument must be an object. Value: `%s`.",e));t=Ai({},e)}else t={};return function(e){return new eo(t,e)}}));var to="debug-stream",ro=Xi(to),no={objectMode:!1,allowHalfOpen:!1,readableObjectMode:!1,name:""};function io(e,t){return qi(t)?tn(t,"name")&&(e.name=t.name,!Vn(e.name))?new TypeError(R("invalid option. `%s` option must be a string. Option: `%s`.","name",e.name)):tn(t,"objectMode")&&(e.objectMode=t.objectMode,!Zr(e.objectMode))?new TypeError(R("invalid option. `%s` option must be a boolean. Option: `%s`.","objectMode",e.objectMode)):tn(t,"readableObjectMode")&&(e.readableObjectMode=t.readableObjectMode,!Zr(e.readableObjectMode))?new TypeError(R("invalid option. `%s` option must be a boolean. Option: `%s`.","readableObjectMode",e.readableObjectMode)):tn(t,"allowHalfOpen")&&(e.allowHalfOpen=t.allowHalfOpen,!Zr(e.allowHalfOpen))?new TypeError(R("invalid option. `%s` option must be a boolean. Option: `%s`.","allowHalfOpen",e.allowHalfOpen)):tn(t,"highWaterMark")&&(e.highWaterMark=t.highWaterMark,!$i(e.highWaterMark))?new TypeError(R("invalid option. `%s` option must be a nonnegative number. Option: `%s`.","highWaterMark",e.highWaterMark)):null:new TypeError(R("invalid argument. Options argument must be an object. Value: `%s`.",t))}var oo=Xi;function ao(e,t){var r,n,i,o,a;if(!(this instanceof ao))return arguments.length>1?new ao(e,t):1===arguments.length?new ao(e):new ao;if(r=Ai({},no),arguments.length>1){if(!kn(t))throw new TypeError(R("invalid argument. Callback argument must be a function. Value: `%s`.",t));a=t,o=io(r,e)}else arguments.length&&(kn(e)?a=e:o=io(r,e));if(o)throw o;return n=r.name?to+":"+r.name:to,i=oo(n),ro("Creating a transform stream configured with the following options: %s.",JSON.stringify(r)),eo.call(this,r,(function(e,t){if(a)return ro("Received a new chunk. Chunk: %s. Index: %d.",e.toString(),t),a(i,e,t);On(e)&&(e=e.toString());e=JSON.stringify(e),ro("Received a new chunk. Chunk: %s. Index: %d.",e,t),i("Chunk: %s. Index: %d.",e,t)})),this}Vi(ao,eo),z(ao,"objectMode",(function(e,t){var r,n;if(arguments.length>1){if(!qi(e))throw new TypeError(R("invalid argument. Options argument must be an object. Value: `%s`.",e));if(r=Ai({},e),n=t,!kn(t))throw new TypeError(R("invalid argument. Callback argument must be a function. Value: `%s`.",t))}else if(arguments.length)if(kn(e))r={},n=e;else{if(!qi(e))throw new TypeError(R("invalid argument. Options argument must be an object. Value: `%s`.",e));r=Ai({},e)}else r={};return r.objectMode=!0,void 0===n?new ao(r):new ao(r,n)})),z(ao,"factory",(function(e){var t;if(arguments.length){if(!qi(e))throw new TypeError(R("invalid argument. Options argument must be an object. Value: `%s`.",e));t=Ai({},e)}else t={};return function(e,r){if(t.name=e,arguments.length>1)return new ao(t,r);return new ao(t)}}));var so={objectMode:!1,decodeStrings:!0,defaultEncoding:"utf8"};var uo=Xi("inspect-stream-sink"),lo=$r.Writable;function fo(e,t){var r,n,i;if(!(this instanceof fo))return arguments.length>1?new fo(e,t):new fo(e);if(n=Ai({},so),arguments.length>1){if(r=t,i=function(e,t){return qi(t)?tn(t,"objectMode")&&(e.objectMode=t.objectMode,!Zr(e.objectMode))?new TypeError(R("invalid option. `%s` option must be a boolean. Option: `%s`.","objectMode",e.objectMode)):tn(t,"highWaterMark")&&(e.highWaterMark=t.highWaterMark,!$i(e.highWaterMark))?new TypeError(R("invalid option. `%s` option must be a nonnegative number. Option: `%s`.","highWaterMark",e.highWaterMark)):tn(t,"decodeStrings")&&(e.decodeStrings=t.decodeStrings,!Zr(e.decodeStrings))?new TypeError(R("invalid option. `%s` option must be a boolean. Option: `%s`.","decodeStrings",e.decodeStrings)):tn(t,"defaultEncoding")&&(e.defaultEncoding=t.defaultEncoding,!Vn(e.defaultEncoding))?new TypeError(R("invalid option. `%s` option must be a string. Option: `%s`.","defaultEncoding",e.defaultEncoding)):null:new TypeError(R("invalid argument. Options argument must be an object. Value: `%s`.",t))}(n,e),i)throw i}else r=e;if(!kn(r))throw new TypeError(R("invalid argument. Callback argument must be a function. Value: `%s`.",r));return uo("Creating a writable stream configured with the following options: %s.",JSON.stringify(n)),lo.call(this,n),Ii(this,"_destroyed",!1),Ii(this,"_idx",-1),z(this,"_inspect",r),this}Vi(fo,lo),z(fo.prototype,"_write",(function(e,t,r){if(this._idx+=1,uo("Received a new chunk. Chunk: %s. Encoding: %s. Index: %d.",e.toString(),t,this._idx),this._inspect.call(null,e,this._idx),this._destroyed)return Ni(r);r()})),z(fo.prototype,"destroy",(function(e){var t;return this._destroyed?(uo("Attempted to destroy an already destroyed stream."),this):(t=this,this._destroyed=!0,Ni((function(){e&&(uo("Stream was destroyed due to an error. Error: %s.",JSON.stringify(e)),t.emit("error",e));uo("Closing the stream..."),t.emit("close")})),this)})),z(fo,"objectMode",(function(e,t){var r,n;if(arguments.length>1){if(!qi(e))throw new TypeError(R("invalid argument. Options argument must be an object. Value: `%s`.",e));r=Ai({},e),n=t}else r={},n=e;return r.objectMode=!0,new fo(r,n)})),z(fo,"factory",(function(e){var t;if(arguments.length){if(!qi(e))throw new TypeError(R("invalid argument. Options argument must be an object. Value: `%s`.",e));t=Ai({},e)}else t={};return function(e){return new fo(t,e)}}));var ho="debug-stream-sink",co=Xi(ho),po={objectMode:!1,decodeStrings:!0,defaultEncoding:"utf8",name:""};function go(e,t){return qi(t)?tn(t,"name")&&(e.name=t.name,!Vn(e.name))?new TypeError(R("invalid option. `%s` option must be a string. Option: `%s`.","name",e.name)):tn(t,"objectMode")&&(e.objectMode=t.objectMode,!Zr(e.objectMode))?new TypeError(R("invalid option. `%s` option must be a boolean. Option: `%s`.","objectMode",e.objectMode)):tn(t,"highWaterMark")&&(e.highWaterMark=t.highWaterMark,!$i(e.highWaterMark))?new TypeError(R("invalid option. `%s` option must be a nonnegative number. Option: `%s`.","highWaterMark",e.highWaterMark)):tn(t,"decodeStrings")&&(e.decodeStrings=t.decodeStrings,!Zr(e.decodeStrings))?new TypeError(R("invalid option. `%s` option must be a boolean. Option: `%s`.","decodeStrings",e.decodeStrings)):tn(t,"defaultEncoding")&&(e.defaultEncoding=t.defaultEncoding,!Vn(e.defaultEncoding))?new TypeError(R("invalid option. `%s` option must be a string. Option: `%s`.","defaultEncoding",e.defaultEncoding)):null:new TypeError(R("invalid argument. Options argument must be an object. Value: `%s`.",t))}var bo=Xi;function mo(e,t){var r,n,i,o,a;if(!(this instanceof mo))return arguments.length>1?new mo(e,t):1===arguments.length?new mo(e):new mo;if(r=Ai({},po),arguments.length>1){if(!kn(t))throw new TypeError(R("invalid argument. Callback argument must be a function. Value: `%s`.",t));a=t,o=go(r,e)}else arguments.length&&(kn(e)?a=e:o=go(r,e));if(o)throw o;return n=r.name?ho+":"+r.name:ho,i=bo(n),co("Creating a writable stream configured with the following options: %s.",JSON.stringify(r)),fo.call(this,r,(function(e,t){if(a)return co("Received a new chunk. Chunk: %s. Index: %d.",e.toString(),t),a(i,e,t);On(e)&&(e=e.toString());e=JSON.stringify(e),co("Received a new chunk. Chunk: %s. Index: %d.",e,t),i("Chunk: %s. Index: %d.",e,t)})),this}function yo(e){if("object"!=typeof e||null===e)return!1;if(e instanceof Error)return!0;for(;e;){if("[object Error]"===an(e))return!0;e=Hi(e)}return!1}Vi(mo,fo),z(mo,"objectMode",(function(e,t){var r,n;if(arguments.length>1){if(!qi(e))throw new TypeError(R("invalid argument. Options argument must be an object. Value: `%s`.",e));if(r=Ai({},e),n=t,!kn(t))throw new TypeError(R("invalid argument. Callback argument must be a function. Value: `%s`.",t))}else if(arguments.length)if(kn(e))r={},n=e;else{if(!qi(e))throw new TypeError(R("invalid argument. Options argument must be an object. Value: `%s`.",e));r=Ai({},e)}else r={};return r.objectMode=!0,void 0===n?new mo(r):new mo(r,n)})),z(mo,"factory",(function(e){var t;if(arguments.length){if(!qi(e))throw new TypeError(R("invalid argument. Options argument must be an object. Value: `%s`.",e));t=Ai({},e)}else t={};return function(e,r){if(t.name=e,arguments.length>1)return new mo(t,r);return new mo(t)}}));var wo={objectMode:!1};var vo=Xi("empty-stream"),_o=$r.Readable;function Eo(e){var t,r;if(!(this instanceof Eo))return arguments.length>0?new Eo(e):new Eo;if(t=Ai({},wo),arguments.length>0&&(r=function(e,t){return qi(t)?tn(t,"objectMode")&&(e.objectMode=t.objectMode,!Zr(e.objectMode))?new TypeError(R("invalid option. `%s` option must be a boolean. Option: `%s`.","objectMode",e.objectMode)):null:new TypeError(R("invalid argument. Options argument must be an object. Value: `%s`.",t))}(t,e),r))throw r;return vo("Creating a readable stream configured with the following options: %s.",JSON.stringify(t)),_o.call(this,t),Ii(this,"_destroyed",!1),this}Vi(Eo,_o),z(Eo.prototype,"_read",(function(){this.push(null)})),z(Eo.prototype,"destroy",(function(e){var t;return this._destroyed?(vo("Attempted to destroy an already destroyed stream."),this):(t=this,this._destroyed=!0,Ni((function(){e&&(vo("Stream was destroyed due to an error. Error: %s.",yo(e)?e.message:JSON.stringify(e)),t.emit("error",e));vo("Closing the stream..."),t.emit("close")})),this)})),z(Eo,"objectMode",(function(){return new Eo({objectMode:!0})})),z(Eo,"factory",(function(e){var t;if(arguments.length>0){if(!qi(e))throw new TypeError(R("invalid argument. Options argument must be an object. Value: `%s`.",e));t=Ai({},e)}else t={};return function(){return new Eo(t)}})),N($e).Buffer;var jo,Mo=function(){throw new Error("not implemented")};jo=kn(Mo.from)?function(e,t){if(!Vn(e))throw new TypeError(R("invalid argument. First argument must be a string. Value: `%s`.",e));if(arguments.length>1){if(!Vn(t))throw new TypeError(R("invalid argument. Second argument must be a string. Value: `%s`.",t));return Mo.from(e,t)}return Mo.from(e,"utf8")}:function(e,t){if(!Vn(e))throw new TypeError(R("invalid argument. First argument must be a string. Value: `%s`.",e));if(arguments.length>1){if(!Vn(t))throw new TypeError(R("invalid argument. Second argument must be a string. Value: `%s`.",t));return new Mo(e,t)}return new Mo(e,"utf8")};var Oo=jo,So={objectMode:!1,encoding:null,sep:"\n",dir:1};var To=Xi("from-array-stream"),ko=$r.Readable;function Ro(e,t){var r,n;if(!(this instanceof Ro))return arguments.length>1?new Ro(e,t):new Ro(e);if(!pi(e))throw new TypeError(R("invalid argument. First argument must be an array-like object. Value: `%s`.",e));if(r=Ai({},So),arguments.length>1&&(n=function(e,t){return qi(t)?tn(t,"sep")&&(e.sep=t.sep,!Vn(e.sep))?new TypeError(R("invalid option. `%s` option must be a string. Option: `%s`.","sep",e.sep)):tn(t,"objectMode")&&(e.objectMode=t.objectMode,!Zr(e.objectMode))?new TypeError(R("invalid option. `%s` option must be a boolean. Option: `%s`.","objectMode",e.objectMode)):tn(t,"encoding")&&(e.encoding=t.encoding,!Vn(e.encoding)&&null!==e.encoding)?new TypeError(R("invalid option. `%s` option must be a string or null. Option: `%s`.","encoding",e.encoding)):tn(t,"highWaterMark")&&(e.highWaterMark=t.highWaterMark,!$i(e.highWaterMark))?new TypeError(R("invalid option. `%s` option must be a nonnegative number. Option: `%s`.","highWaterMark",e.highWaterMark)):tn(t,"serialize")&&(e.serialize=t.serialize,!kn(e.serialize))?new TypeError(R("invalid option. `%s` option must be a function. Option: `%s`.","serialize",e.serialize)):tn(t,"dir")&&(e.dir=t.dir,1!==e.dir&&-1!==e.dir)?new TypeError(R("invalid option. `%s` option must be either `1` or `-1`. Option: `%s`.","dir",e.dir)):null:new TypeError(R("invalid argument. Options argument must be an object. Value: `%s`.",t))}(r,t),n))throw n;return To("Creating a readable stream configured with the following options: %s.",JSON.stringify(r)),ko.call(this,r),Ii(this,"_destroyed",!1),z(this,"_objectMode",r.objectMode),z(this,"_sep",r.sep),z(this,"_serialize",r.serialize||JSON.stringify),z(this,"_src",e),z(this,"_stride",r.dir),Ii(this,"_i",0),Ii(this,"_idx",1===r.dir?0:e.length-1),this}Vi(Ro,ko),z(Ro.prototype,"_read",(function(){var e,t,r;if(!this._destroyed)for(e=!0;e;){if(t=null,this._i+=1,this._i>this._src.length)return To("Finished iteration."),this.push(null);r=this._src[this._idx],To("Value: %s. Idx: %d. Iter: %d.",JSON.stringify(r),this._idx,this._i),this._idx+=this._stride,!1===this._objectMode&&("string"==typeof(r=this._serialize(r))?r=1===this._i?Oo(r):Oo(this._sep+r):On(r)?this._i>1&&(r=Mo.concat([Oo(this._sep),r])):t=new Error(R("invalid operation. Serialization function must return a string or Buffer. Value: `%s`.",r))),t?this.emit("error",t):e=this.push(r)}})),z(Ro.prototype,"destroy",(function(e){var t;return this._destroyed?(To("Attempted to destroy an already destroyed stream."),this):(t=this,this._destroyed=!0,Ni((function(){e&&(To("Stream was destroyed due to an error. Error: %s.",yo(e)?e.message:JSON.stringify(e)),t.emit("error",e));To("Closing the stream..."),t.emit("close")})),this)})),z(Ro,"objectMode",(function(e,t){var r;if(arguments.length>1){if(!qi(r=t))throw new TypeError(R("invalid argument. Options argument must be an object. Value: `%s`.",r));r=Ai({},t)}else r={};return r.objectMode=!0,new Ro(e,r)})),z(Ro,"factory",(function(e){var t;if(arguments.length){if(!qi(e))throw new TypeError(R("invalid argument. Options argument must be an object. Value: `%s`.",e));t=Ai({},e)}else t={};return function(e){return new Ro(e,t)}}));var xo={objectMode:!1,encoding:null,sep:"\n",iter:1e308,dir:1};function Ao(e){return ri(e)&&e>=0}function Lo(e){return ni(e)&&e.valueOf()>=0}function Co(e){return Ao(e)||Lo(e)}z(Co,"isPrimitive",Ao),z(Co,"isObject",Lo);var Po=Xi("from-circular-array-stream"),Wo=$r.Readable;function Vo(e,t){var r,n;if(!(this instanceof Vo))return arguments.length>1?new Vo(e,t):new Vo(e);if(!pi(e))throw new TypeError(R("invalid argument. First argument must be an array-like object. Value: `%s`.",e));if(r=Ai({},xo),arguments.length>1&&(n=function(e,t){return qi(t)?tn(t,"sep")&&(e.sep=t.sep,!Vn(e.sep))?new TypeError(R("invalid option. `%s` option must be a string. Option: `%s`.","sep",e.sep)):tn(t,"objectMode")&&(e.objectMode=t.objectMode,!Zr(e.objectMode))?new TypeError(R("invalid option. `%s` option must be a boolean. Option: `%s`.","objectMode",e.objectMode)):tn(t,"encoding")&&(e.encoding=t.encoding,!Vn(e.encoding)&&null!==e.encoding)?new TypeError(R("invalid option. `%s` option must be a string or null. Option: `%s`.","encoding",e.encoding)):tn(t,"highWaterMark")&&(e.highWaterMark=t.highWaterMark,!$i(e.highWaterMark))?new TypeError(R("invalid option. `%s` option must be a nonnegative number. Option: `%s`.","highWaterMark",e.highWaterMark)):tn(t,"serialize")&&(e.serialize=t.serialize,!kn(e.serialize))?new TypeError(R("invalid option. `%s` option must be a function. Option: `%s`.","serialize",e.serialize)):tn(t,"iter")&&(e.iter=t.iter,!Ao(e.iter))?new TypeError(R("invalid option. `%s` option must be a nonnegative integer. Option: `%s`.","iter",e.iter)):tn(t,"dir")&&(e.dir=t.dir,1!==e.dir&&-1!==e.dir)?new TypeError(R("invalid option. `%s` option must be either `1` or `-1`. Option: `%s`.","dir",e.dir)):null:new TypeError(R("invalid argument. Options argument must be an object. Value: `%s`.",t))}(r,t),n))throw n;return Po("Creating a readable stream configured with the following options: %s.",JSON.stringify(r)),Wo.call(this,r),Ii(this,"_destroyed",!1),z(this,"_objectMode",r.objectMode),z(this,"_sep",r.sep),z(this,"_serialize",r.serialize||JSON.stringify),z(this,"_src",e),z(this,"_stride",r.dir),z(this,"_iter",r.iter),Ii(this,"_i",0),Ii(this,"_idx",1===r.dir?-1:e.length),this}Vi(Vo,Wo),z(Vo.prototype,"_read",(function(){var e,t,r;if(!this._destroyed)for(e=!0;e;){if(t=null,this._i+=1,this._i>this._iter||0===this._src.length)return Po("Finished iteration."),this.push(null);this._idx+=this._stride,this._stride>0&&this._idx>=this._src.length?this._idx%=this._src.length:this._stride<0&&this._idx<0&&(this._idx+=this._src.length),r=this._src[this._idx],Po("Value: %s. Idx: %d. Iter: %d.",JSON.stringify(r),this._idx,this._i),!1===this._objectMode&&("string"==typeof(r=this._serialize(r))?r=1===this._i?Oo(r):Oo(this._sep+r):On(r)?this._i>1&&(r=Mo.concat([Oo(this._sep),r])):t=new Error(R("invalid operation. Serialization function must return a string or Buffer. Value: `%s`.",r))),t?this.emit("error",t):e=this.push(r)}})),z(Vo.prototype,"destroy",(function(e){var t;return this._destroyed?(Po("Attempted to destroy an already destroyed stream."),this):(t=this,this._destroyed=!0,Ni((function(){e&&(Po("Stream was destroyed due to an error. Error: %s.",yo(e)?e.message:JSON.stringify(e)),t.emit("error",e));Po("Closing the stream..."),t.emit("close")})),this)})),z(Vo,"objectMode",(function(e,t){var r;if(arguments.length>1){if(!qi(r=t))throw new TypeError(R("invalid argument. Options argument must be an object. Value: `%s`.",r));r=Ai({},t)}else r={};return r.objectMode=!0,new Vo(e,r)})),z(Vo,"factory",(function(e){var t;if(arguments.length){if(!qi(e))throw new TypeError(R("invalid argument. Options argument must be an object. Value: `%s`.",e));t=Ai({},e)}else t={};return function(e){return new Vo(e,t)}}));var Io="function"==typeof Uint8Array;function Bo(e){return Io&&e instanceof Uint8Array||"[object Uint8Array]"===an(e)}var zo=Object.prototype.toString;var No=new Function("try {return this === global;} catch ( err ) {return false;}")(),Uo=Bi,Do=gn(),Fo=/node|io\.js/;var Yo,Ho,Jo="object"==typeof $&&$===Do&&Do===Do.global&&("[object global]"===an(Do)||"[object Object]"===an(Do))&&!0===No&&"object"==typeof Uo&&"[object process]"===(Yo=Uo,zo.call(Yo))&&qi(Uo.versions)&&Vn(Uo.versions.node)&&(void 0===Uo.release||qi(Uo.release)&&Vn(Uo.release.name)&&Fo.test(Uo.release.name)),qo=Bi.versions.node,$o=(Ho=Jo?qo:null,Ho?parseInt(Ho.split(".")[0],10):-1),Go=kn(Mo.from)&&$o>=5,Zo="function"==typeof ArrayBuffer;function Xo(e){return Zo&&e instanceof ArrayBuffer||"[object ArrayBuffer]"===an(e)}var Ko="function"==typeof Uint8Array?Uint8Array:null;var Qo,ea="function"==typeof Uint8Array?Uint8Array:void 0;Qo=function(){var e,t;if("function"!=typeof Ko)return!1;try{e=Bo(t=new Ko(t=[1,3.14,-3.14,256,257]))&&1===t[0]&&3===t[1]&&253===t[2]&&0===t[3]&&1===t[4]}catch(t){e=!1}return e}()?ea:function(){throw new Error("not implemented")};var ta=Qo;var ra,na=kn(Mo.from)?function(e){if(!pi(e))throw new TypeError(R("invalid argument. Must provide an array-like object. Value: `%s`.",e));return Mo.from(e)}:function(e){if(!pi(e))throw new TypeError(R("invalid argument. Must provide an array-like object. Value: `%s`.",e));return new Mo(e)};ra=Go?function(e,t,r){var n,i;if(!Xo(e))throw new TypeError(R("invalid argument. First argument must be an ArrayBuffer. Value: `%s`.",e));if(arguments.length>1){if(!Ao(t))throw new TypeError(R("invalid argument. Second argument must be a nonnegative integer. Value: `%s`.",t));if(t>e.byteLength)throw new RangeError(R("invalid argument. Second argument must not exceed the number of bytes in the input ArrayBuffer. Value: `%s`.",t));if(n=t,arguments.length>2){if(!Ao(r))throw new TypeError(R("invalid argument. Last argument must be a nonnegative integer. Value: `%s`.",r));if(r>e.byteLength)throw new RangeError(R("invalid argument. Last argument must not exceed the number of bytes in the input ArrayBuffer. Value: `%s`.",r));i=r}else i=e.byteLength-n}else n=0,i=e.byteLength;return 0===i&&$o<6?Mo.from([]):Mo.from(e,n,i)}:function(e,t,r){var n;if(!Xo(e))throw new TypeError(R("invalid argument. First argument must be an ArrayBuffer. Value: `%s`.",e));if(arguments.length>1){if(!Ao(t))throw new TypeError(R("invalid argument. Second argument must be a nonnegative integer. Value: `%s`.",t));if(t>e.byteLength)throw new RangeError(R("invalid argument. Second argument must not exceed the number of bytes in the input ArrayBuffer. Value: `%s`.",t));if(arguments.length>2){if(!Ao(r))throw new TypeError(R("invalid argument. Last argument must be a nonnegative integer. Value: `%s`.",r));if(r>e.byteLength)throw new RangeError(R("invalid argument. Last argument must not exceed the number of bytes in the input ArrayBuffer. Value: `%s`.",r));n=r}else n=e.byteLength-t;return na(new ta(e,t,n))}return $o<3?na(new ta(e)):0===e.byteLength?new Mo([]):new Mo(e)};var ia=ra,oa={objectMode:!1,encoding:null,sep:"\n",iter:1e308};var aa=Xi("from-constant-stream"),sa=$r.Readable;function ua(e,t){var r,n;if(!(this instanceof ua))return arguments.length>1?new ua(e,t):new ua(e);if(r=Ai({},oa),arguments.length>1&&(n=function(e,t){return qi(t)?tn(t,"sep")&&(e.sep=t.sep,!Vn(e.sep))?new TypeError(R("invalid option. `%s` option must be a string. Option: `%s`.","sep",e.sep)):tn(t,"objectMode")&&(e.objectMode=t.objectMode,!Zr(e.objectMode))?new TypeError(R("invalid option. `%s` option must be a boolean. Option: `%s`.","objectMode",e.objectMode)):tn(t,"encoding")&&(e.encoding=t.encoding,!Vn(e.encoding)&&null!==e.encoding)?new TypeError(R("invalid option. `%s` option must be a string or null. Option: `%s`.","encoding",e.encoding)):tn(t,"highWaterMark")&&(e.highWaterMark=t.highWaterMark,!$i(e.highWaterMark))?new TypeError(R("invalid option. `%s` option must be a nonnegative number. Option: `%s`.","highWaterMark",e.highWaterMark)):tn(t,"iter")&&(e.iter=t.iter,!Ao(e.iter))?new TypeError(R("invalid option. `%s` option must be a nonnegative integer. Option: `%s`.","iter",e.iter)):null:new TypeError(R("invalid argument. Options argument must be an object. Value: `%s`.",t))}(r,t),n))throw n;if(!1===r.objectMode)if(Vn(e))e=Oo(e);else if(On(e));else{if(!Bo(e))throw new TypeError(R("invalid argument. In binary mode, a provided value must be a string, Buffer, or Uint8Array. Value: `%s`.",e));e=ia(e.buffer,e.byteOffset,e.length)}return aa("Creating a readable stream configured with the following options: %s.",JSON.stringify(r)),sa.call(this,r),Ii(this,"_destroyed",!1),z(this,"_objectMode",r.objectMode),z(this,"_sep",Oo(r.sep)),z(this,"_iter",r.iter),z(this,"_value",e),Ii(this,"_i",0),this}Vi(ua,sa),z(ua.prototype,"_read",(function(){var e;if(!this._destroyed)for(e=!0;e;){if(this._i+=1,this._i>this._iter)return aa("Finished iteration."),this.push(null);aa("Value: %s. Iter: %d.",this._value,this._i),e=!1===this._objectMode&&this._i>1?this.push(Mo.concat([this._sep,this._value])):this.push(this._value)}})),z(ua.prototype,"destroy",(function(e){var t;return this._destroyed?(aa("Attempted to destroy an already destroyed stream."),this):(t=this,this._destroyed=!0,Ni((function(){e&&(aa("Stream was destroyed due to an error. Error: %s.",yo(e)?e.message:JSON.stringify(e)),t.emit("error",e));aa("Closing the stream..."),t.emit("close")})),this)})),z(ua,"objectMode",(function(e,t){var r;if(arguments.length>1){if(!qi(r=t))throw new TypeError(R("invalid argument. Options argument must be an object. Value: `%s`.",r));r=Ai({},t)}else r={};return r.objectMode=!0,new ua(e,r)})),z(ua,"factory",(function(e,t){var r,n,i;if(0===(r=arguments.length))n={},i=!0;else if(1===r)null!==e&&"object"==typeof e&&(tn(e,"sep")||tn(e,"iter")||tn(e,"objectMode")||tn(e,"encoding")||tn(e,"highWaterMark"))?(n=Ai({},e),i=!0):n={};else{if(!qi(t))throw new TypeError(R("invalid argument. Options argument must be an object. Value: `%s`.",t));n=Ai({},t)}return i?function(e){return new ua(e,n)}:function(){return new ua(e,n)}}));var la={objectMode:!1,encoding:null,sep:"\n"};var fa=Xi("from-iterator-stream"),ha=$r.Readable;function ca(e,t){var r,n;if(!(this instanceof ca))return arguments.length>1?new ca(e,t):new ca(e);if(!function(e){var t=typeof e;return null!==e&&("object"===t||"function"===t)&&kn(e.next)}(e))throw new TypeError(R("invalid argument. First argument must be an iterator. Value: `%s`.",e));if(r=Ai({},la),arguments.length>1&&(n=function(e,t){return qi(t)?tn(t,"sep")&&(e.sep=t.sep,!Vn(e.sep))?new TypeError(R("invalid option. `%s` option must be a string. Option: `%s`.","sep",e.sep)):tn(t,"objectMode")&&(e.objectMode=t.objectMode,!Zr(e.objectMode))?new TypeError(R("invalid option. `%s` option must be a boolean. Option: `%s`.","objectMode",e.objectMode)):tn(t,"encoding")&&(e.encoding=t.encoding,!Vn(e.encoding)&&null!==e.encoding)?new TypeError(R("invalid option. `%s` option must be a string or null. Option: `%s`.","encoding",e.encoding)):tn(t,"highWaterMark")&&(e.highWaterMark=t.highWaterMark,!$i(e.highWaterMark))?new TypeError(R("invalid option. `%s` option must be a nonnegative number. Option: `%s`.","highWaterMark",e.highWaterMark)):tn(t,"serialize")&&(e.serialize=t.serialize,!kn(e.serialize))?new TypeError(R("invalid option. `%s` option must be a function. Option: `%s`.","serialize",e.serialize)):null:new TypeError(R("invalid argument. Options argument must be an object. Value: `%s`.",t))}(r,t),n))throw n;return fa("Creating a readable stream configured with the following options: %s.",JSON.stringify(r)),ha.call(this,r),Ii(this,"_destroyed",!1),z(this,"_objectMode",r.objectMode),z(this,"_sep",r.sep),z(this,"_serialize",r.serialize||JSON.stringify),z(this,"_iterator",e),Ii(this,"_i",0),this}Vi(ca,ha),z(ca.prototype,"_read",(function(){var e,t,r;if(!this._destroyed)for(e=!0;e;){if(r=this._iterator.next(),this._i+=1,r.done)return tn(r,"value")&&(r=r.value,fa("Value: %s. Iter: %d.",JSON.stringify(r),this._i),!1===this._objectMode&&("string"==typeof(r=this._serialize(r))?(r=1===this._i?Oo(r):Oo(this._sep+r),this.push(r)):On(r)?(this._i>1&&(r=Mo.concat([Oo(this._sep),r])),this.push(r)):(t=new Error(R("invalid operation. Serialization function must return a string or Buffer. Value: `%s`.",r)),this.emit("error",t)))),fa("Finished iteration."),this.push(null);if(r=r.value,fa("Value: %s. Iter: %d.",JSON.stringify(r),this._i),!1===this._objectMode)if("string"==typeof(r=this._serialize(r)))r=1===this._i?Oo(r):Oo(this._sep+r);else{if(!On(r)){t=new Error(R("invalid operation. Serialization function must return a string or Buffer. Value: `%s`.",r)),this.emit("error",t);continue}this._i>1&&(r=Mo.concat([Oo(this._sep),r]))}e=this.push(r)}})),z(ca.prototype,"destroy",(function(e){var t;return this._destroyed?(fa("Attempted to destroy an already destroyed stream."),this):(t=this,this._destroyed=!0,Ni((function(){e&&(fa("Stream was destroyed due to an error. Error: %s.",yo(e)?e.message:JSON.stringify(e)),t.emit("error",e));fa("Closing the stream..."),t.emit("close")})),this)})),z(ca,"objectMode",(function(e,t){var r;if(arguments.length>1){if(!qi(r=t))throw new TypeError(R("invalid argument. Options argument must be an object. Value: `%s`.",r));r=Ai({},t)}else r={};return r.objectMode=!0,new ca(e,r)})),z(ca,"factory",(function(e){var t;if(arguments.length){if(!qi(e))throw new TypeError(R("invalid argument. Options argument must be an object. Value: `%s`.",e));t=Ai({},e)}else t={};return function(e){return new ca(e,t)}}));var da={objectMode:!1,encoding:null,sep:"\n"};var pa=Xi("from-strided-array-stream"),ga=$r.Readable;function ba(e,t,r,n,i){var o,a,s;if(!(this instanceof ba))return arguments.length>4?new ba(e,t,r,n,i):new ba(e,t,r,n);if(!Ao(e))throw new TypeError(R("invalid argument. First argument must be a nonnegative integer. Value: `%s`.",e));if(!pi(t))throw new TypeError(R("invalid argument. Second argument must be an array-like object. Value: `%s`.",t));if(!ri(r))throw new TypeError(R("invalid argument. Third argument must be an integer. Value: `%s`.",r));if(!Ao(n))throw new TypeError(R("invalid argument. Fourth argument must be a nonnegative integer. Value: `%s`.",n));if(e>0&&(s=n+(e-1)*r,n>=t.length||s<0||s>=t.length))throw new RangeError("invalid arguments. Strided array parameters are incompatible with the provided array-like object. Linear index exceeds array bounds.");if(o=Ai({},da),arguments.length>4&&(a=function(e,t){return qi(t)?tn(t,"sep")&&(e.sep=t.sep,!Vn(e.sep))?new TypeError(R("invalid option. `%s` option must be a string. Option: `%s`.","sep",e.sep)):tn(t,"objectMode")&&(e.objectMode=t.objectMode,!Zr(e.objectMode))?new TypeError(R("invalid option. `%s` option must be a boolean. Option: `%s`.","objectMode",e.objectMode)):tn(t,"encoding")&&(e.encoding=t.encoding,!Vn(e.encoding)&&null!==e.encoding)?new TypeError(R("invalid option. `%s` option must be a string or null. Option: `%s`.","encoding",e.encoding)):tn(t,"highWaterMark")&&(e.highWaterMark=t.highWaterMark,!$i(e.highWaterMark))?new TypeError(R("invalid option. `%s` option must be a nonnegative number. Option: `%s`.","highWaterMark",e.highWaterMark)):tn(t,"serialize")&&(e.serialize=t.serialize,!kn(e.serialize))?new TypeError(R("invalid option. `%s` option must be a function. Option: `%s`.","serialize",e.serialize)):null:new TypeError(R("invalid argument. Options argument must be an object. Value: `%s`.",t))}(o,i),a))throw a;return pa("Creating a readable stream configured with the following options: %s.",JSON.stringify(o)),ga.call(this,o),Ii(this,"_destroyed",!1),z(this,"_objectMode",o.objectMode),z(this,"_sep",o.sep),z(this,"_serialize",o.serialize||JSON.stringify),z(this,"_buffer",t),z(this,"_N",e),z(this,"_stride",r),z(this,"_offset",n),Ii(this,"_idx",n),Ii(this,"_i",0),this}Vi(ba,ga),z(ba.prototype,"_read",(function(){var e,t,r;if(!this._destroyed)for(e=!0;e;){if(t=null,this._i+=1,this._i>this._N)return pa("Finished iteration."),this.push(null);r=this._buffer[this._idx],pa("Value: %s. Idx: %d. Iter: %d.",JSON.stringify(r),this._idx,this._i),this._idx+=this._stride,!1===this._objectMode&&("string"==typeof(r=this._serialize(r))?r=1===this._i?Oo(r):Oo(this._sep+r):On(r)?this._i>1&&(r=Mo.concat([Oo(this._sep),r])):t=new Error(R("invalid operation. Serialization function must return a string or Buffer. Value: `%s`.",r))),t?this.emit("error",t):e=this.push(r)}})),z(ba.prototype,"destroy",(function(e){var t;return this._destroyed?(pa("Attempted to destroy an already destroyed stream."),this):(t=this,this._destroyed=!0,Ni((function(){e&&(pa("Stream was destroyed due to an error. Error: %s.",yo(e)?e.message:JSON.stringify(e)),t.emit("error",e));pa("Closing the stream..."),t.emit("close")})),this)})),z(ba,"objectMode",(function(e,t,r,n,i){var o;if(arguments.length>4){if(!qi(o=i))throw new TypeError(R("invalid argument. Options argument must be an object. Value: `%s`.",o));o=Ai({},i)}else o={};return o.objectMode=!0,new ba(e,t,r,n,o)})),z(ba,"factory",(function(e){var t;if(arguments.length){if(!qi(e))throw new TypeError(R("invalid argument. Options argument must be an object. Value: `%s`.",e));t=Ai({},e)}else t={};return function(e,r,n,i){return new ba(e,r,n,i,t)}}));var ma=Xi("join-stream"),ya=$r.Transform;function wa(e){var t,r;if(!(this instanceof wa))return arguments.length?new wa(e):new wa;if(t={objectMode:!1,encoding:null,allowHalfOpen:!1,readableObjectMode:!1,sep:"\n"},arguments.length&&(r=function(e,t){return qi(t)?tn(t,"sep")&&(e.sep=t.sep,!Vn(e.sep))?new TypeError(R("invalid option. `%s` option must be a string. Option: `%s`.","sep",e.sep)):tn(t,"objectMode")&&(e.objectMode=t.objectMode,!Zr(e.objectMode))?new TypeError(R("invalid option. `%s` option must be a boolean. Option: `%s`.","objectMode",e.objectMode)):tn(t,"readableObjectMode")&&(e.readableObjectMode=t.readableObjectMode,!Zr(e.readableObjectMode))?new TypeError(R("invalid option. `%s` option must be a boolean. Option: `%s`.","readableObjectMode",e.readableObjectMode)):tn(t,"encoding")&&(e.encoding=t.encoding,!Vn(e.encoding))?new TypeError(R("invalid option. `%s` option must be a string. Option: `%s`.","encoding",e.encoding)):tn(t,"allowHalfOpen")&&(e.allowHalfOpen=t.allowHalfOpen,!Zr(e.allowHalfOpen))?new TypeError(R("invalid option. `%s` option must be a boolean. Option: `%s`.","allowHalfOpen",e.allowHalfOpen)):tn(t,"highWaterMark")&&(e.highWaterMark=t.highWaterMark,!$i(e.highWaterMark))?new TypeError(R("invalid option. `%s` option must be a nonnegative number. Option: `%s`.","highWaterMark",e.highWaterMark)):null:new TypeError(R("invalid argument. Options argument must be an object. Value: `%s`.",t))}(t,e),r))throw r;return t.writableObjectMode=!0,t.decodeStrings=!1,ma("Creating a transform stream configured with the following options: %s.",JSON.stringify(t)),ya.call(this,t),Ii(this,"_destroyed",!1),z(this,"_encoding",null===t.encoding?"utf8":t.encoding),"utf8"!==this._encoding&&(t.sep=Oo(t.sep,this._encoding)),z(this,"_sep",t.sep),Ii(this,"_init",!1),Ii(this,"_idx",-1),this}Vi(wa,ya),z(wa.prototype,"_transform",(function(e,t,r){var n;this._idx+=1,ma("Received a new chunk. Chunk: %s. Encoding: %s. Index: %d.",e.toString(),t,this._idx),"utf8"===this._encoding?this._init?e=this._sep+e:this._init=!0:this._init?(e=new Mo(e,t),n=this._sep.length+e.length,e=(e=Mo.concat([this._sep,e],n)).toString(this._encoding)):this._init=!0,this.push(e,this._encoding),r()})),z(wa.prototype,"_flush",(function(e){ma("Flushing the stream..."),e()})),z(wa.prototype,"destroy",(function(e){var t;return this._destroyed?(ma("Attempted to destroy an already destroyed stream."),this):(t=this,this._destroyed=!0,Ni((function(){e&&(ma("Stream was destroyed due to an error. Error: %s.",JSON.stringify(e)),t.emit("error",e));ma("Closing the stream..."),t.emit("close")})),this)})),z(wa,"objectMode",(function(e){var t;if(arguments.length){if(!qi(e))throw new TypeError(R("invalid argument. Options argument must be an object. Value: `%s`.",e));t=Ai({},e)}else t={};return t.objectMode=!0,new wa(t)})),z(wa,"factory",(function(e){var t;if(arguments.length){if(!qi(e))throw new TypeError(R("invalid argument. Options argument must be an object. Value: `%s`.",e));t=Ai({},e)}else t={};return function(){return new wa(t)}}));var va={objectMode:!1,encoding:null,allowHalfOpen:!1,writableObjectMode:!1,sep:null},_a=RegExp.prototype.exec;var Ea=Kr();function ja(e){return"object"==typeof e&&(e instanceof RegExp||(Ea?function(e){try{return _a.call(e),!0}catch(e){return!1}}(e):"[object RegExp]"===an(e)))}var Ma=Xi("split-stream");function Oa(e,t){return"utf8"===t||"buffer"===t?e:(e=Oo(e),t?e.toString(t):e.toString())}var Sa=$r.Transform,Ta=/\r?\n/;function ka(e){var t,r;if(!(this instanceof ka))return arguments.length?new ka(e):new ka;if(t=Ai({},va),arguments.length&&(r=function(e,t){return qi(t)?!tn(t,"sep")||(e.sep=t.sep,Vn(e.sep)||ja(e.sep))?tn(t,"objectMode")&&(e.objectMode=t.objectMode,!Zr(e.objectMode))?new TypeError(R("invalid option. `%s` option must be a boolean. Option: `%s`.","objectMode",e.objectMode)):tn(t,"writableObjectMode")&&(e.writableObjectMode=t.writableObjectMode,!Zr(e.writableObjectMode))?new TypeError(R("invalid option. `%s` option must be a boolean. Option: `%s`.","writableObjectMode",e.writableObjectMode)):tn(t,"encoding")&&(e.encoding=t.encoding,!Vn(e.encoding))?new TypeError(R("invalid option. `%s` option must be a string. Option: `%s`.","encoding",e.encoding)):tn(t,"allowHalfOpen")&&(e.allowHalfOpen=t.allowHalfOpen,!Zr(e.allowHalfOpen))?new TypeError(R("invalid option. `%s` option must be a boolean. Option: `%s`.","allowHalfOpen",e.allowHalfOpen)):tn(t,"highWaterMark")&&(e.highWaterMark=t.highWaterMark,!$i(e.highWaterMark))?new TypeError(R("invalid option. `%s` option must be a nonnegative number. Option: `%s`.","highWaterMark",e.highWaterMark)):null:new TypeError(R("invalid option. `%s` option must be either a string or a regular expression. Option: `%s`.","sep",e.sep)):new TypeError(R("invalid argument. Options argument must be an object. Value: `%s`.",t))}(t,e),r))throw r;return t.readableObjectMode=!0,t.decodeStrings=!1,Ma("Creating a transform stream configured with the following options: %s.",JSON.stringify(t)),Sa.call(this,t),z(this,"_sep",null===t.sep?Ta:t.sep),Ii(this,"_destroyed",!1),z(this,"_encoding",t.encoding),Ii(this,"_buffer",""),Ii(this,"_idx",-1),this}Vi(ka,Sa),z(ka.prototype,"_transform",(function(e,t,r){var n,i,o,a;if(this._idx+=1,Ma("Received a new chunk. Chunk: %s. Encoding: %s. Index: %d.",e.toString(),t,this._idx),"buffer"===t?e=e.toString():"utf8"!==t&&(e=(e=new Mo(e,t)).toString("utf8")),n=e.split(this._sep),Ma("Splits: %s. Index: %d.",JSON.stringify(n),this._idx),o=n.length-1,Ma("%s splits. Index: %d.",o,this._idx),0===o)Ma("No splits. Index: %d.",this._idx),this._buffer+=n[o];else{for(Ma("Processing splits. Index: %d.",this._index),i=Oa(i=this._buffer+n[0],t),Ma("Split %d: %s. Index: %d.",0,i.toString(),this._idx),this.push(i,t),a=1;a1?t.flush=r:delete t.flush;return new Ua(t)}})),z(Ua,"ctor",(function(e){var t,r,n;if(r=Ai({},La),arguments.length&&(n=Ca(r,e)))throw n;function i(e){var t,n;if(!(this instanceof i))return arguments.length?new i(e):new i;if(t=Ai({},r),arguments.length&&(n=Ca(t,e)))throw n;return Ya("Creating a transform stream configured with the following options: %s.",JSON.stringify(t)),Fa.call(this,t),this._destroyed=!1,this}return t=r.transform?r.transform:Ia,Vi(i,Fa),i.prototype._transform=t,r.flush&&(i.prototype._flush=r.flush),i.prototype.destroy=Wa,i}));var Ha={};return B(Ha,"debugStream",ao),B(Ha,"debugSinkStream",mo),B(Ha,"emptyStream",Eo),B(Ha,"arrayStream",Ro),B(Ha,"circularArrayStream",Vo),B(Ha,"constantStream",ua),B(Ha,"iteratorStream",ca),B(Ha,"stridedArrayStream",ba),B(Ha,"inspectStream",eo),B(Ha,"inspectSinkStream",fo),B(Ha,"joinStream",wa),B(Ha,"splitStream",ka),B(Ha,"stderr",Ra),B(Ha,"stdin",xa),B(Ha,"stdout",Aa),B(Ha,"transformStream",Ua),Ha})); +//# sourceMappingURL=browser.js.map diff --git a/browser.js.map b/browser.js.map new file mode 100644 index 0000000..28e0896 --- /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/utils-type-of/lib/fixtures/re.js","../node_modules/@stdlib/assert-is-boolean/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/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-global/lib/browser.js","../node_modules/@stdlib/utils-global/lib/codegen.js","../node_modules/@stdlib/utils-type-of/lib/fixtures/nodelist.js","../node_modules/@stdlib/utils-type-of/lib/fixtures/typedarray.js","../node_modules/@stdlib/regexp-function-name/lib/main.js","../node_modules/@stdlib/regexp-function-name/lib/regexp.js","../node_modules/@stdlib/assert-is-array/lib/main.js","../node_modules/@stdlib/regexp-function-name/lib/index.js","../node_modules/@stdlib/assert-is-object-like/lib/main.js","../node_modules/@stdlib/assert-is-object-like/lib/index.js","../node_modules/@stdlib/assert-tools-array-function/lib/main.js","../node_modules/@stdlib/assert-is-buffer/lib/main.js","../node_modules/@stdlib/utils-constructor-name/lib/main.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/object-assign/lib/has_object_assign.js","../node_modules/@stdlib/object-assign/lib/builtin.js","../node_modules/@stdlib/utils-keys/lib/builtin.js","../node_modules/@stdlib/utils-keys/lib/has_builtin.js","../node_modules/@stdlib/assert-is-arguments/lib/detect.js","../node_modules/@stdlib/assert-is-arguments/lib/main.js","../node_modules/@stdlib/assert-is-string/lib/primitive.js","../node_modules/@stdlib/assert-is-string/lib/valueof.js","../node_modules/@stdlib/assert-is-string/lib/object.js","../node_modules/@stdlib/assert-is-string/lib/try2valueof.js","../node_modules/@stdlib/assert-is-string/lib/main.js","../node_modules/@stdlib/assert-is-number/lib/primitive.js","../node_modules/@stdlib/assert-is-string/lib/index.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/math-base-assert-is-nan/lib/main.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-number/lib/index.js","../node_modules/@stdlib/assert-is-nan/lib/index.js","../node_modules/@stdlib/constants-float64-pinf/lib/index.js","../node_modules/@stdlib/constants-float64-ninf/lib/index.js","../node_modules/@stdlib/math-base-special-floor/lib/main.js","../node_modules/@stdlib/math-base-assert-is-integer/lib/main.js","../node_modules/@stdlib/assert-is-integer/lib/integer.js","../node_modules/@stdlib/assert-is-integer/lib/primitive.js","../node_modules/@stdlib/assert-is-integer/lib/object.js","../node_modules/@stdlib/assert-is-integer/lib/main.js","../node_modules/@stdlib/assert-is-integer/lib/index.js","../node_modules/@stdlib/assert-is-enumerable-property/lib/native.js","../node_modules/@stdlib/assert-is-enumerable-property/lib/has_string_enumerability_bug.js","../node_modules/@stdlib/assert-is-enumerable-property/lib/main.js","../node_modules/@stdlib/constants-uint32-max/lib/index.js","../node_modules/@stdlib/assert-is-arguments/lib/index.js","../node_modules/@stdlib/assert-is-arguments/lib/polyfill.js","../node_modules/@stdlib/utils-keys/lib/builtin_wrapper.js","../node_modules/@stdlib/utils-keys/lib/has_enumerable_prototype_bug.js","../node_modules/@stdlib/utils-noop/lib/main.js","../node_modules/@stdlib/utils-keys/lib/has_non_enumerable_properties_bug.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/utils-index-of/lib/main.js","../node_modules/@stdlib/utils-keys/lib/is_constructor_prototype.js","../node_modules/@stdlib/utils-keys/lib/window.js","../node_modules/@stdlib/utils-keys/lib/has_automation_equality_bug.js","../node_modules/@stdlib/utils-keys/lib/has_window.js","../node_modules/@stdlib/utils-keys/lib/main.js","../node_modules/@stdlib/utils-keys/lib/has_arguments_bug.js","../node_modules/@stdlib/utils-keys/lib/polyfill.js","../node_modules/@stdlib/utils-keys/lib/is_constructor_prototype_wrapper.js","../node_modules/@stdlib/utils-property-symbols/lib/index.js","../node_modules/@stdlib/utils-property-symbols/lib/has_builtin.js","../node_modules/@stdlib/object-ctor/lib/main.js","../node_modules/@stdlib/utils-property-symbols/lib/builtin.js","../node_modules/@stdlib/utils-property-symbols/lib/polyfill.js","../node_modules/@stdlib/object-assign/lib/index.js","../node_modules/@stdlib/utils-enumerable-properties/lib/main.js","../node_modules/@stdlib/object-assign/lib/polyfill.js","../node_modules/@stdlib/utils-inherit/lib/validate.js","../node_modules/@stdlib/utils-inherit/lib/native.js","../node_modules/@stdlib/utils-inherit/lib/polyfill.js","../node_modules/@stdlib/utils-inherit/lib/detect.js","../node_modules/@stdlib/utils-inherit/lib/main.js","../node_modules/@stdlib/utils-define-nonenumerable-property/lib/main.js","../node_modules/@stdlib/utils-next-tick/lib/main.js","../node_modules/@stdlib/utils-get-prototype-of/lib/native.js","../node_modules/@stdlib/utils-get-prototype-of/lib/detect.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","../node_modules/@stdlib/assert-is-object/lib/main.js","../node_modules/@stdlib/assert-is-nonnegative-number/lib/primitive.js","../node_modules/@stdlib/assert-is-nonnegative-number/lib/object.js","../node_modules/@stdlib/assert-is-nonnegative-number/lib/main.js","../node_modules/@stdlib/assert-is-nonnegative-number/lib/index.js","../node_modules/@stdlib/streams-node-inspect/lib/debug.js","../node_modules/@stdlib/streams-node-inspect/lib/main.js","../node_modules/@stdlib/streams-node-inspect/lib/validate.js","../node_modules/@stdlib/streams-node-inspect/lib/index.js","../node_modules/@stdlib/streams-node-inspect/lib/object_mode.js","../node_modules/@stdlib/streams-node-inspect/lib/factory.js","../node_modules/@stdlib/streams-node-debug/lib/namespace.js","../node_modules/@stdlib/streams-node-debug/lib/debug.js","../node_modules/@stdlib/streams-node-debug/lib/validate.js","../node_modules/@stdlib/streams-node-debug/lib/logger.js","../node_modules/@stdlib/streams-node-debug/lib/main.js","../node_modules/@stdlib/streams-node-debug/lib/index.js","../node_modules/@stdlib/streams-node-debug/lib/object_mode.js","../node_modules/@stdlib/streams-node-debug/lib/factory.js","../node_modules/@stdlib/streams-node-inspect-sink/lib/debug.js","../node_modules/@stdlib/streams-node-inspect-sink/lib/main.js","../node_modules/@stdlib/streams-node-inspect-sink/lib/validate.js","../node_modules/@stdlib/streams-node-inspect-sink/lib/index.js","../node_modules/@stdlib/streams-node-inspect-sink/lib/object_mode.js","../node_modules/@stdlib/streams-node-inspect-sink/lib/factory.js","../node_modules/@stdlib/streams-node-debug-sink/lib/namespace.js","../node_modules/@stdlib/streams-node-debug-sink/lib/debug.js","../node_modules/@stdlib/streams-node-debug-sink/lib/validate.js","../node_modules/@stdlib/streams-node-debug-sink/lib/logger.js","../node_modules/@stdlib/streams-node-debug-sink/lib/main.js","../node_modules/@stdlib/assert-is-error/lib/main.js","../node_modules/@stdlib/streams-node-debug-sink/lib/index.js","../node_modules/@stdlib/streams-node-debug-sink/lib/object_mode.js","../node_modules/@stdlib/streams-node-debug-sink/lib/factory.js","../node_modules/@stdlib/streams-node-empty/lib/debug.js","../node_modules/@stdlib/streams-node-empty/lib/main.js","../node_modules/@stdlib/streams-node-empty/lib/validate.js","../node_modules/@stdlib/streams-node-empty/lib/index.js","../node_modules/@stdlib/streams-node-empty/lib/object_mode.js","../node_modules/@stdlib/streams-node-empty/lib/factory.js","../node_modules/@stdlib/buffer-ctor/lib/main.js","../node_modules/@stdlib/buffer-ctor/lib/index.js","../node_modules/@stdlib/buffer-from-string/lib/index.js","../node_modules/@stdlib/buffer-ctor/lib/polyfill.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","../node_modules/@stdlib/streams-node-from-array/lib/debug.js","../node_modules/@stdlib/streams-node-from-array/lib/main.js","../node_modules/@stdlib/streams-node-from-array/lib/validate.js","../node_modules/@stdlib/streams-node-from-array/lib/index.js","../node_modules/@stdlib/streams-node-from-array/lib/object_mode.js","../node_modules/@stdlib/streams-node-from-array/lib/factory.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-nonnegative-integer/lib/index.js","../node_modules/@stdlib/streams-node-from-circular-array/lib/debug.js","../node_modules/@stdlib/streams-node-from-circular-array/lib/main.js","../node_modules/@stdlib/streams-node-from-circular-array/lib/validate.js","../node_modules/@stdlib/streams-node-from-circular-array/lib/index.js","../node_modules/@stdlib/streams-node-from-circular-array/lib/object_mode.js","../node_modules/@stdlib/streams-node-from-circular-array/lib/factory.js","../node_modules/@stdlib/assert-is-uint8array/lib/main.js","../node_modules/@stdlib/assert-is-node/lib/to_string.js","../node_modules/@stdlib/assert-is-node/lib/global_scope.js","../node_modules/@stdlib/assert-is-node/lib/main.js","../node_modules/@stdlib/assert-is-node/lib/index.js","../node_modules/@stdlib/process-node-version/lib/index.js","../node_modules/@stdlib/process-node-version/lib/main.js","../node_modules/@stdlib/process-node-version/lib/process.js","../node_modules/@stdlib/buffer-from-arraybuffer/lib/node_version.js","../node_modules/@stdlib/process-node-version/lib/browser.js","../node_modules/@stdlib/buffer-from-arraybuffer/lib/has_from.js","../node_modules/@stdlib/assert-is-arraybuffer/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/buffer-from-array/lib/index.js","../node_modules/@stdlib/buffer-from-arraybuffer/lib/index.js","../node_modules/@stdlib/buffer-from-array/lib/has_from.js","../node_modules/@stdlib/buffer-from-array/lib/main.js","../node_modules/@stdlib/buffer-from-array/lib/polyfill.js","../node_modules/@stdlib/buffer-from-arraybuffer/lib/main.js","../node_modules/@stdlib/buffer-from-arraybuffer/lib/polyfill.js","../node_modules/@stdlib/streams-node-from-constant/lib/debug.js","../node_modules/@stdlib/streams-node-from-constant/lib/main.js","../node_modules/@stdlib/streams-node-from-constant/lib/validate.js","../node_modules/@stdlib/streams-node-from-constant/lib/index.js","../node_modules/@stdlib/streams-node-from-constant/lib/object_mode.js","../node_modules/@stdlib/streams-node-from-constant/lib/factory.js","../node_modules/@stdlib/streams-node-from-iterator/lib/debug.js","../node_modules/@stdlib/streams-node-from-iterator/lib/main.js","../node_modules/@stdlib/assert-is-iterator-like/lib/main.js","../node_modules/@stdlib/streams-node-from-iterator/lib/validate.js","../node_modules/@stdlib/streams-node-from-iterator/lib/index.js","../node_modules/@stdlib/streams-node-from-iterator/lib/object_mode.js","../node_modules/@stdlib/streams-node-from-iterator/lib/factory.js","../node_modules/@stdlib/streams-node-from-strided-array/lib/debug.js","../node_modules/@stdlib/streams-node-from-strided-array/lib/main.js","../node_modules/@stdlib/streams-node-from-strided-array/lib/validate.js","../node_modules/@stdlib/streams-node-from-strided-array/lib/index.js","../node_modules/@stdlib/streams-node-from-strided-array/lib/object_mode.js","../node_modules/@stdlib/streams-node-from-strided-array/lib/factory.js","../node_modules/@stdlib/streams-node-join/lib/debug.js","../node_modules/@stdlib/streams-node-join/lib/main.js","../node_modules/@stdlib/streams-node-join/lib/defaults.js","../node_modules/@stdlib/streams-node-join/lib/validate.js","../node_modules/@stdlib/streams-node-join/lib/index.js","../node_modules/@stdlib/streams-node-join/lib/object_mode.js","../node_modules/@stdlib/streams-node-join/lib/factory.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","../node_modules/@stdlib/streams-node-split/lib/debug.js","../node_modules/@stdlib/streams-node-split/lib/decode.js","../node_modules/@stdlib/streams-node-split/lib/main.js","../node_modules/@stdlib/streams-node-split/lib/validate.js","../node_modules/@stdlib/streams-node-split/lib/index.js","../node_modules/@stdlib/streams-node-split/lib/object_mode.js","../node_modules/@stdlib/streams-node-split/lib/factory.js","../node_modules/@stdlib/streams-node-stderr/lib/main.js","../node_modules/@stdlib/streams-node-stdin/lib/main.js","../node_modules/@stdlib/streams-node-stdout/lib/main.js","../node_modules/@stdlib/streams-node-transform/lib/validate.js","../node_modules/@stdlib/streams-node-transform/lib/destroy.js","../node_modules/@stdlib/streams-node-transform/lib/_transform.js","../node_modules/@stdlib/streams-node-transform/lib/main.js","../node_modules/@stdlib/streams-node-transform/lib/ctor.js","../node_modules/@stdlib/streams-node-transform/lib/index.js","../node_modules/@stdlib/streams-node-transform/lib/object_mode.js","../node_modules/@stdlib/streams-node-transform/lib/factory.js","../lib/index.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\nimport isNumber from './is_number.js';\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 {Object} token - token object\n* @throws {Error} must provide a valid floating-point number\n* @returns {string} formatted token argument\n*/\nfunction formatDouble( token ) {\n\tvar digits;\n\tvar out;\n\tvar f = parseFloat( token.arg );\n\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\tif ( !isNumber( token.arg ) ) {\n\t\t\tthrow new Error( 'invalid floating-point number. Value: ' + out );\n\t\t}\n\t\t// Case: NaN, Infinity, or -Infinity\n\t\tf = token.arg;\n\t}\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 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 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\ttoken.arg = formatDouble( 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\ttokens.push( parse( match ) );\n\t\tprev = RE.lastIndex;\n\t\tmatch = RE.exec( str );\n\t}\n\tcontent = str.slice( prev );\n\tif ( content.length ) {\n\t\ttokens.push( content );\n\t}\n\treturn tokens;\n}\n\n\n// EXPORTS //\n\nexport default formatTokenize;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport interpolate from '@stdlib/string-base-format-interpolate';\nimport tokenize from '@stdlib/string-base-format-tokenize';\nimport isString from './is_string.js';\n\n\n// MAIN //\n\n/**\n* Inserts supplied variable values into a format string.\n*\n* @param {string} str - input string\n* @param {Array} ...args - variable values\n* @throws {TypeError} first argument must be a string\n* @throws {Error} invalid flags\n* @returns {string} formatted string\n*\n* @example\n* var str = format( 'Hello %s!', 'world' );\n* // returns 'Hello world!'\n*\n* @example\n* var str = format( 'Pi: ~%.2f', 3.141592653589793 );\n* // returns 'Pi: ~3.14'\n*/\nfunction format( str ) {\n\tvar args;\n\tvar i;\n\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\targs = [ tokenize( str ) ];\n\tfor ( i = 1; i < arguments.length; i++ ) {\n\t\targs.push( arguments[ i ] );\n\t}\n\treturn interpolate.apply( null, args );\n}\n\n\n// EXPORTS //\n\nexport default format;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Tests if a value is a string primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string primitive\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns false\n*/\nfunction isString( value ) {\n\treturn ( typeof value === 'string' ); // NOTE: we inline the `isString.isPrimitive` function from `@stdlib/assert/is-string` in order to avoid circular dependencies.\n}\n\n\n// EXPORTS //\n\nexport default isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n/* eslint-disable no-underscore-dangle, no-proto */\n\n'use strict';\n\n// MODULES //\n\nimport format from '@stdlib/string-format';\n\n\n// VARIABLES //\n\nvar objectProtoype = Object.prototype;\nvar toStr = objectProtoype.toString;\nvar defineGetter = objectProtoype.__defineGetter__;\nvar defineSetter = objectProtoype.__defineSetter__;\nvar lookupGetter = objectProtoype.__lookupGetter__;\nvar lookupSetter = objectProtoype.__lookupSetter__;\n\n\n// MAIN //\n\n/**\n* Defines (or modifies) an object property.\n*\n* ## Notes\n*\n* - Property descriptors come in two flavors: **data descriptors** and **accessor descriptors**. A data descriptor is a property that has a value, which may or may not be writable. An accessor descriptor is a property described by a getter-setter function pair. A descriptor must be one of these two flavors and cannot be both.\n*\n* @param {Object} obj - object on which to define the property\n* @param {string} prop - property name\n* @param {Object} descriptor - property descriptor\n* @param {boolean} [descriptor.configurable=false] - boolean indicating if property descriptor can be changed and if the property can be deleted from the provided object\n* @param {boolean} [descriptor.enumerable=false] - boolean indicating if the property shows up when enumerating object properties\n* @param {boolean} [descriptor.writable=false] - boolean indicating if the value associated with the property can be changed with an assignment operator\n* @param {*} [descriptor.value] - property value\n* @param {(Function|void)} [descriptor.get=undefined] - function which serves as a getter for the property, or, if no getter, undefined. When the property is accessed, a getter function is called without arguments and with the `this` context set to the object through which the property is accessed (which may not be the object on which the property is defined due to inheritance). The return value will be used as the property value.\n* @param {(Function|void)} [descriptor.set=undefined] - function which serves as a setter for the property, or, if no setter, undefined. When assigning a property value, a setter function is called with one argument (the value being assigned to the property) and with the `this` context set to the object through which the property is assigned.\n* @throws {TypeError} first argument must be an object\n* @throws {TypeError} third argument must be an object\n* @throws {Error} property descriptor cannot have both a value and a setter and/or getter\n* @returns {Object} object with added property\n*\n* @example\n* var obj = {};\n*\n* defineProperty( obj, 'foo', {\n* 'value': 'bar'\n* });\n*\n* var str = obj.foo;\n* // returns 'bar'\n*/\nfunction defineProperty( obj, prop, descriptor ) {\n\tvar prototype;\n\tvar hasValue;\n\tvar hasGet;\n\tvar hasSet;\n\n\tif ( typeof obj !== 'object' || obj === null || toStr.call( obj ) === '[object Array]' ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an object. Value: `%s`.', obj ) );\n\t}\n\tif ( typeof descriptor !== 'object' || descriptor === null || toStr.call( descriptor ) === '[object Array]' ) {\n\t\tthrow new TypeError( format( 'invalid argument. Property descriptor must be an object. Value: `%s`.', descriptor ) );\n\t}\n\thasValue = ( 'value' in descriptor );\n\tif ( hasValue ) {\n\t\tif (\n\t\t\tlookupGetter.call( obj, prop ) ||\n\t\t\tlookupSetter.call( obj, prop )\n\t\t) {\n\t\t\t// Override `__proto__` to avoid touching inherited accessors:\n\t\t\tprototype = obj.__proto__;\n\t\t\tobj.__proto__ = objectProtoype;\n\n\t\t\t// Delete property as existing getters/setters prevent assigning value to specified property:\n\t\t\tdelete obj[ prop ];\n\t\t\tobj[ prop ] = descriptor.value;\n\n\t\t\t// Restore original prototype:\n\t\t\tobj.__proto__ = prototype;\n\t\t} else {\n\t\t\tobj[ prop ] = descriptor.value;\n\t\t}\n\t}\n\thasGet = ( 'get' in descriptor );\n\thasSet = ( 'set' in descriptor );\n\n\tif ( hasValue && ( hasGet || hasSet ) ) {\n\t\tthrow new Error( 'invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.' );\n\t}\n\n\tif ( hasGet && defineGetter ) {\n\t\tdefineGetter.call( obj, prop, descriptor.get );\n\t}\n\tif ( hasSet && defineSetter ) {\n\t\tdefineSetter.call( obj, prop, descriptor.set );\n\t}\n\treturn obj;\n}\n\n\n// EXPORTS //\n\nexport default defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Define (or modify) an object property.\n*\n* @module @stdlib/utils-define-property\n*\n* @example\n* import defineProperty from '@stdlib/utils-define-property';\n*\n* var obj = {};\n* defineProperty( obj, 'foo', {\n* 'value': 'bar',\n* 'writable': false,\n* 'configurable': false,\n* 'enumerable': false\n* });\n* obj.foo = 'boop'; // => throws\n*/\n\n// MODULES //\n\nimport hasDefinePropertySupport from './has_define_property_support.js';\nimport builtin from './builtin.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar defineProperty;\nif ( hasDefinePropertySupport() ) {\n\tdefineProperty = builtin;\n} else {\n\tdefineProperty = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport defineProperty from './define_property.js';\n\n\n// MAIN //\n\n/**\n* Tests for `Object.defineProperty` support.\n*\n* @private\n* @returns {boolean} boolean indicating if an environment has `Object.defineProperty` support\n*\n* @example\n* var bool = hasDefinePropertySupport();\n* // returns \n*/\nfunction hasDefinePropertySupport() {\n\t// Test basic support...\n\ttry {\n\t\tdefineProperty( {}, 'x', {} );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default hasDefinePropertySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport defineProperty from '@stdlib/utils-define-property';\n\n\n// MAIN //\n\n/**\n* Defines a 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 '@stdlib/utils-define-property';\n\n\n// MAIN //\n\n/**\n* Defines a non-enumerable read-only property.\n*\n* @param {Object} obj - object on which to define the property\n* @param {(string|symbol)} prop - property name\n* @param {*} value - value to set\n*\n* @example\n* var obj = {};\n*\n* setNonEnumerableReadOnly( obj, 'foo', 'bar' );\n*\n* try {\n* obj.foo = 'boop';\n* } catch ( err ) {\n* console.error( err.message );\n* }\n*/\nfunction setNonEnumerableReadOnly( obj, prop, value ) {\n\tdefineProperty( obj, prop, {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': false,\n\t\t'value': value\n\t});\n}\n\n\n// EXPORTS //\n\nexport default setNonEnumerableReadOnly;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\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) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport hasSymbols from '@stdlib/assert-has-symbol-support';\n\n\n// VARIABLES //\n\nvar FLG = hasSymbols();\n\n\n// MAIN //\n\n/**\n* Tests for native `toStringTag` support.\n*\n* @returns {boolean} boolean indicating if an environment has `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) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Returns a boolean.\n*\n* @name Boolean\n* @constructor\n* @type {Function}\n* @param {*} value - input value\n* @returns {(boolean|Boolean)} boolean\n*\n* @example\n* var b = Boolean( null );\n* // returns false\n*\n* b = Boolean( [] );\n* // returns true\n*\n* b = Boolean( {} );\n* // returns true\n*\n* @example\n* var b = new Boolean( false );\n* // returns \n*/\nvar Bool = Boolean; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// eslint-disable-next-line stdlib/no-redeclare\nvar toString = Boolean.prototype.toString; // non-generic\n\n\n// EXPORTS //\n\nexport default toString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport nativeClass from '@stdlib/utils-native-class';\nimport Boolean from '@stdlib/boolean-ctor';\nimport test from './try2serialize.js';\n\n\n// VARIABLES //\n\nvar FLG = hasToStringTag();\n\n\n// MAIN //\n\n/**\n* Tests if a value is a boolean object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a boolean object\n*\n* @example\n* var bool = isBoolean( true );\n* // returns false\n*\n* @example\n* import Boolean from '@stdlib/boolean-ctor';\n*\n* var bool = isBoolean( new Boolean( false ) );\n* // returns true\n*/\nfunction isBoolean( value ) {\n\tif ( typeof value === 'object' ) {\n\t\tif ( value instanceof Boolean ) {\n\t\t\treturn true;\n\t\t}\n\t\tif ( FLG ) {\n\t\t\treturn test( value );\n\t\t}\n\t\treturn ( nativeClass( value ) === '[object Boolean]' );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nexport default isBoolean;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport toString from './tostring.js'; // eslint-disable-line stdlib/no-redeclare\n\n\n// MAIN //\n\n/**\n* Attempts to serialize a value to a string.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value can be serialized\n*/\nfunction test( value ) {\n\ttry {\n\t\ttoString.call( value );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isPrimitive from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a boolean.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a boolean\n*\n* @example\n* var bool = isBoolean( false );\n* // returns true\n*\n* @example\n* var bool = isBoolean( true );\n* // returns true\n*\n* @example\n* import Boolean from '@stdlib/boolean-ctor';\n*\n* var bool = isBoolean( new Boolean( false ) );\n* // returns true\n*\n* @example\n* import Boolean from '@stdlib/boolean-ctor';\n*\n* var bool = isBoolean( new Boolean( true ) );\n* // returns true\n*/\nfunction isBoolean( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nexport default isBoolean;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Test if a value is a boolean.\n*\n* @module @stdlib/assert-is-boolean\n*\n* @example\n* import Boolean from '@stdlib/boolean-ctor';\n* import isBoolean from '@stdlib/assert-is-boolean';\n*\n* var bool = isBoolean( false );\n* // returns true\n*\n* bool = isBoolean( new Boolean( false ) );\n* // returns true\n*\n* @example\n* import Boolean from '@stdlib/boolean-ctor';\n* import { isPrimitive as isBoolean } from '@stdlib/assert-is-boolean';\n*\n* var bool = isBoolean( false );\n* // returns true\n*\n* bool = isBoolean( new Boolean( true ) );\n* // returns false\n*\n* @example\n* import Boolean from '@stdlib/boolean-ctor';\n* import { isObject as isBoolean } from '@stdlib/assert-is-boolean';\n*\n* var bool = isBoolean( true );\n* // returns false\n*\n* bool = isBoolean( new Boolean( false ) );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport isPrimitive from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'isPrimitive', isPrimitive );\nsetReadOnly( main, 'isObject', isObject );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\nvar obj = ( typeof self === 'object' ) ? self : null;\n\n\n// EXPORTS //\n\nexport default obj;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\nvar obj = ( typeof window === 'object' ) ? window : null;\n\n\n// EXPORTS //\n\nexport default obj;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\nvar obj = ( typeof globalThis === 'object' ) ? globalThis : null; // eslint-disable-line no-undef\n\n\n// EXPORTS //\n\nexport default obj;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 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\n// MODULES //\n\nimport getGlobal from '@stdlib/utils-global';\n\n\n// MAIN //\n\nvar root = getGlobal();\nvar nodeList = root.document && root.document.childNodes;\n\n\n// EXPORTS //\n\nexport default nodeList;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\nvar typedarray = Int8Array; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default typedarray;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Returns a regular expression to capture everything that is not a space immediately after the `function` keyword and before the first left parenthesis.\n*\n* @returns {RegExp} regular expression\n*\n* @example\n* var RE_FUNCTION_NAME = reFunctionName();\n*\n* function fname( fcn ) {\n* return RE_FUNCTION_NAME.exec( fcn.toString() )[ 1 ];\n* }\n*\n* var fn = fname( Math.sqrt );\n* // returns 'sqrt'\n*\n* fn = fname( Int8Array );\n* // returns 'Int8Array'\n*\n* fn = fname( Object.prototype.toString );\n* // returns 'toString'\n*\n* fn = fname( function(){} );\n* // returns ''\n*/\nfunction reFunctionName() {\n\treturn /^\\s*function\\s*([^(]*)/i;\n}\n\n\n// EXPORTS //\n\nexport default reFunctionName;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport reFunctionName from './main.js';\n\n\n// MAIN //\n\n/**\n* Captures everything that is not a space immediately after the `function` keyword and before the first left parenthesis.\n*\n* Regular expression: `/^\\s*function\\s*([^(]*)/i`\n*\n* - `/^\\s*`\n* - Match zero or more spaces at beginning\n*\n* - `function`\n* - Match the word `function`\n*\n* - `\\s*`\n* - Match zero or more spaces after the word `function`\n*\n* - `()`\n* - Capture\n*\n* - `[^(]*`\n* - Match anything except a left parenthesis `(` zero or more times\n*\n* - `/i`\n* - ignore case\n*\n* @constant\n* @type {RegExp}\n* @default /^\\s*function\\s*([^(]*)/i\n*/\nvar RE_FUNCTION_NAME = reFunctionName();\n\n\n// EXPORTS //\n\nexport default RE_FUNCTION_NAME;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport 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) 2021 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Regular expression to capture everything that is not a space immediately after the `function` keyword and before the first left parenthesis.\n*\n* @module @stdlib/regexp-function-name\n*\n* @example\n* import reFunctionName from '@stdlib/regexp-function-name';\n* var RE_FUNCTION_NAME = reFunctionName();\n*\n* function fname( fcn ) {\n* return RE_FUNCTION_NAME.exec( fcn.toString() )[ 1 ];\n* }\n*\n* var fn = fname( Math.sqrt );\n* // returns 'sqrt'\n*\n* fn = fname( Int8Array );\n* // returns 'Int8Array'\n*\n* fn = fname( Object.prototype.toString );\n* // returns 'toString'\n*\n* fn = fname( function(){} );\n* // returns ''\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport REGEXP from './regexp.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'REGEXP', REGEXP );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* 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/**\n* Test if a value is object-like.\n*\n* @module @stdlib/assert-is-object-like\n*\n* @example\n* import isObjectLike from '@stdlib/assert-is-object-like';\n*\n* var bool = isObjectLike( {} );\n* // returns true\n*\n* bool = isObjectLike( [] );\n* // returns true\n*\n* bool = isObjectLike( null );\n* // returns false\n*\n* @example\n* import { isObjectLikeArray as isObjectLike } from '@stdlib/assert-is-object-like';\n*\n* var bool = isObjectLike( [ {}, [] ] );\n* // returns true\n*\n* bool = isObjectLike( [ {}, '3.0' ] );\n* // returns false\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport arrayfun from '@stdlib/assert-tools-array-function';\nimport main from './main.js';\n\n\n// VARIABLES //\n\nvar isObjectLikeArray = arrayfun( main );\n\n\n// MAIN //\n\nsetReadOnly( main, 'isObjectLikeArray', isObjectLikeArray );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isArray from '@stdlib/assert-is-array';\nimport format from '@stdlib/string-format';\n\n\n// MAIN //\n\n/**\n* Returns a function which tests if every element in an array passes a test condition.\n*\n* @param {Function} predicate - function to apply\n* @throws {TypeError} must provide a function\n* @returns {Function} an array function\n*\n* @example\n* import isOdd from '@stdlib/assert-is-odd';\n*\n* var arr1 = [ 1, 3, 5, 7 ];\n* var arr2 = [ 3, 5, 8 ];\n*\n* var validate = arrayfcn( isOdd );\n*\n* var bool = validate( arr1 );\n* // returns true\n*\n* bool = validate( arr2 );\n* // returns false\n*/\nfunction arrayfcn( predicate ) {\n\tif ( typeof predicate !== 'function' ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a function. Value: `%s`.', predicate ) );\n\t}\n\treturn every;\n\n\t/**\n\t* Tests if every element in an array passes a test condition.\n\t*\n\t* @private\n\t* @param {*} value - value to test\n\t* @returns {boolean} boolean indicating whether a value is an array for which all elements pass a test condition\n\t*/\n\tfunction every( value ) {\n\t\tvar len;\n\t\tvar i;\n\t\tif ( !isArray( value ) ) {\n\t\t\treturn false;\n\t\t}\n\t\tlen = value.length;\n\t\tif ( len === 0 ) {\n\t\t\treturn false;\n\t\t}\n\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\tif ( predicate( value[ i ] ) === false ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default arrayfcn;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isObjectLike from '@stdlib/assert-is-object-like';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Buffer instance.\n*\n* @param {*} value - value to validate\n* @returns {boolean} boolean indicating if a value is a Buffer instance\n*\n* @example\n* var v = isBuffer( new Buffer( 'beep' ) );\n* // returns true\n*\n* @example\n* var v = isBuffer( new Buffer( [1,2,3,4] ) );\n* // returns true\n*\n* @example\n* var v = isBuffer( {} );\n* // returns false\n*\n* @example\n* var v = isBuffer( [] );\n* // returns false\n*/\nfunction isBuffer( value ) {\n\treturn (\n\t\tisObjectLike( value ) &&\n\t\t(\n\t\t\t// eslint-disable-next-line no-underscore-dangle\n\t\t\tvalue._isBuffer || // for envs missing Object.prototype.constructor (e.g., Safari 5-7)\n\t\t\t(\n\t\t\t\tvalue.constructor &&\n\n\t\t\t\t// WARNING: `typeof` is not a foolproof check, as certain envs consider RegExp and NodeList instances to be functions\n\t\t\t\ttypeof value.constructor.isBuffer === 'function' &&\n\t\t\t\tvalue.constructor.isBuffer( value )\n\t\t\t)\n\t\t)\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isBuffer;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\nimport { REGEXP as RE } from '@stdlib/regexp-function-name';\nimport isBuffer from '@stdlib/assert-is-buffer';\n\n\n// MAIN //\n\n/**\n* Determines the name of a value's constructor.\n*\n* @param {*} v - input value\n* @returns {string} name of a value's constructor\n*\n* @example\n* var v = constructorName( 'a' );\n* // returns 'String'\n*\n* @example\n* var v = constructorName( 5 );\n* // returns 'Number'\n*\n* @example\n* var v = constructorName( null );\n* // returns 'Null'\n*\n* @example\n* var v = constructorName( undefined );\n* // returns 'Undefined'\n*\n* @example\n* var v = constructorName( function noop() {} );\n* // returns 'Function'\n*/\nfunction constructorName( v ) {\n\tvar match;\n\tvar name;\n\tvar ctor;\n\tname = nativeClass( v ).slice( 8, -1 );\n\tif ( (name === 'Object' || name === 'Error') && v.constructor ) {\n\t\tctor = v.constructor;\n\t\tif ( typeof ctor.name === 'string' ) {\n\t\t\treturn ctor.name;\n\t\t}\n\t\tmatch = RE.exec( ctor.toString() );\n\t\tif ( match ) {\n\t\t\treturn match[ 1 ];\n\t\t}\n\t}\n\tif ( isBuffer( v ) ) {\n\t\treturn 'Buffer';\n\t}\n\treturn name;\n}\n\n\n// EXPORTS //\n\nexport default constructorName;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Determine a value's type.\n*\n* @module @stdlib/utils-type-of\n*\n* @example\n* import typeOf from '@stdlib/utils-type-of';\n*\n* var str = typeOf( 'a' );\n* // returns 'string'\n*\n* str = typeOf( 5 );\n* // returns 'number'\n*/\n\n// MODULES //\n\nimport usePolyfill from './check.js';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main = ( usePolyfill() ) ? polyfill : builtin;\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport RE from './fixtures/re.js';\nimport nodeList from './fixtures/nodelist.js';\nimport typedarray from './fixtures/typedarray.js';\n\n\n// MAIN //\n\n/**\n* Checks whether a polyfill is needed when using the `typeof` operator.\n*\n* @private\n* @returns {boolean} boolean indicating whether a polyfill is needed\n*/\nfunction check() {\n\tif (\n\t\t// Chrome 1-12 returns 'function' for regular expression instances (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof):\n\t\ttypeof RE === 'function' ||\n\n\t\t// Safari 8 returns 'object' for typed array and weak map constructors (underscore #1929):\n\t\ttypeof typedarray === 'object' ||\n\n\t\t// PhantomJS 1.9 returns 'function' for `NodeList` instances (underscore #2236):\n\t\ttypeof nodeList === 'function'\n\t) {\n\t\treturn true;\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nexport default check;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport ctorName from '@stdlib/utils-constructor-name';\n\n\n// MAIN //\n\n/**\n* Determines a value's type.\n*\n* @param {*} v - input value\n* @returns {string} string indicating the value's type\n*/\nfunction typeOf( v ) {\n\treturn ctorName( v ).toLowerCase();\n}\n\n\n// EXPORTS //\n\nexport default typeOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport ctorName from '@stdlib/utils-constructor-name';\n\n\n// NOTES //\n\n/*\n* Built-in `typeof` operator behavior:\n*\n* ```text\n* typeof null => 'object'\n* typeof undefined => 'undefined'\n* typeof 'a' => 'string'\n* typeof 5 => 'number'\n* typeof NaN => 'number'\n* typeof true => 'boolean'\n* typeof false => 'boolean'\n* typeof {} => 'object'\n* typeof [] => 'object'\n* typeof function foo(){} => 'function'\n* typeof function* foo(){} => 'object'\n* typeof Symbol() => 'symbol'\n* ```\n*\n*/\n\n\n// MAIN //\n\n/**\n* Determines a value's type.\n*\n* @param {*} v - input value\n* @returns {string} string indicating the value's type\n*/\nfunction typeOf( v ) {\n\tvar type;\n\n\t// Address `typeof null` => `object` (see http://wiki.ecmascript.org/doku.php?id=harmony:typeof_null):\n\tif ( v === null ) {\n\t\treturn 'null';\n\t}\n\ttype = typeof v;\n\n\t// If the `typeof` operator returned something other than `object`, we are done. Otherwise, we need to check for an internal class name or search for a constructor.\n\tif ( type === 'object' ) {\n\t\treturn ctorName( v ).toLowerCase();\n\t}\n\treturn type;\n}\n\n\n// EXPORTS //\n\nexport default typeOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport typeOf from '@stdlib/utils-type-of';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a function.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a function\n*\n* @example\n* function beep() {\n* return 'beep';\n* }\n*\n* var bool = isFunction( beep );\n* // returns true\n*/\nfunction isFunction( value ) {\n\t// Note: cannot use `typeof` directly, as various browser engines incorrectly return `'function'` when operating on non-function objects, such as regular expressions and NodeLists.\n\treturn ( typeOf( value ) === 'function' );\n}\n\n\n// EXPORTS //\n\nexport default isFunction;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 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';\n\n\n// MAIN //\n\nvar bool = isFunction( Object.assign ); // eslint-disable-line node/no-unsupported-features/es-builtins\n\n\n// EXPORTS //\n\nexport default bool;\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* Copies own enumerable properties from source objects to a target object.\n*\n* ## Notes\n*\n* - If a property key is present in multiple sources, the property from the last source that defines the key prevails.\n* - The target object is mutated.\n*\n* @name assign\n* @type {Function}\n* @param {Object} target - target object\n* @param {...Object} source - source object(s)\n* @throws {TypeError} first argument must not be null or undefined\n* @returns {Object} target object\n*\n* @example\n* var obj1 = {\n* 'a': 'beep'\n* };\n* var obj2 = {\n* 'b': 'boop'\n* };\n*\n* var out = assign( obj1, obj2 );\n* // returns { 'a': 'beep', 'b': 'boop' }\n*/\nvar assign = Object.assign; // eslint-disable-line node/no-unsupported-features/es-builtins\n\n\n// EXPORTS //\n\nexport default assign;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 array of an object's own enumerable property names.\n*\n* ## Notes\n*\n* - In contrast to the built-in `Object.keys()`, this function returns an empty array if provided `undefined` or `null`, rather than throwing an error.\n*\n* @private\n* @param {*} value - input object\n* @returns {Array} a list of own enumerable property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var k = keys( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nfunction keys( value ) {\n\treturn Object.keys( Object( value ) );\n}\n\n\n// EXPORTS //\n\nexport default keys;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 Object.keys !== 'undefined' );\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 isArguments from './main.js';\n\n\n// VARIABLES //\n\nvar bool;\n\n\n// FUNCTIONS //\n\n/**\n* Detects whether an environment returns the expected internal class of the `arguments` object.\n*\n* @private\n* @returns {boolean} boolean indicating whether an environment behaves as expected\n*\n* @example\n* var bool = detect();\n* // returns \n*/\nfunction detect() {\n\treturn isArguments( arguments );\n}\n\n\n// MAIN //\n\nbool = detect();\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 nativeClass from '@stdlib/utils-native-class';\n\n\n// MAIN //\n\n/**\n* Tests whether a value is an `arguments` object.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is an `arguments` object\n*\n* @example\n* function foo() {\n* return arguments;\n* }\n*\n* var bool = isArguments( foo() );\n* // returns true\n*\n* @example\n* var bool = isArguments( [] );\n* // returns false\n*/\nfunction isArguments( value ) {\n\treturn ( nativeClass( value ) === '[object Arguments]' );\n}\n\n\n// EXPORTS //\n\nexport default isArguments;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Tests if a value is a string primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string primitive\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns false\n*/\nfunction isString( value ) {\n\treturn ( typeof value === 'string' );\n}\n\n\n// EXPORTS //\n\nexport default isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// eslint-disable-next-line stdlib/no-redeclare\nvar valueOf = String.prototype.valueOf; // non-generic\n\n\n// EXPORTS //\n\nexport default valueOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport nativeClass from '@stdlib/utils-native-class';\nimport test from './try2valueof.js';\n\n\n// VARIABLES //\n\nvar FLG = hasToStringTag();\n\n\n// MAIN //\n\n/**\n* Tests if a value is a string object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string object\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns true\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns false\n*/\nfunction isString( value ) {\n\tif ( typeof value === 'object' ) {\n\t\tif ( value instanceof String ) {\n\t\t\treturn true;\n\t\t}\n\t\tif ( FLG ) {\n\t\t\treturn test( value );\n\t\t}\n\t\treturn ( nativeClass( value ) === '[object String]' );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nexport default isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport valueOf from './valueof.js'; // eslint-disable-line stdlib/no-redeclare\n\n\n// MAIN //\n\n/**\n* Attempts to extract a string value.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a string can be extracted\n*/\nfunction test( value ) {\n\ttry {\n\t\tvalueOf.call( value );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isPrimitive from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a string.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a string\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns true\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*/\nfunction isString( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nexport default isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* 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/**\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// EXPORTS //\n\nexport default Number; // eslint-disable-line stdlib/require-globals\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Number from '@stdlib/number-ctor';\n\n\n// MAIN //\n\n// eslint-disable-next-line stdlib/no-redeclare\nvar toString = Number.prototype.toString; // non-generic\n\n\n// EXPORTS //\n\nexport default toString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport nativeClass from '@stdlib/utils-native-class';\nimport Number from '@stdlib/number-ctor';\nimport test from './try2serialize.js';\n\n\n// VARIABLES //\n\nvar FLG = hasToStringTag();\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object\n*\n* @example\n* var bool = isNumber( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isNumber( new Number( 3.14 ) );\n* // returns true\n*/\nfunction isNumber( value ) {\n\tif ( typeof value === 'object' ) {\n\t\tif ( value instanceof Number ) {\n\t\t\treturn true;\n\t\t}\n\t\tif ( FLG ) {\n\t\t\treturn test( value );\n\t\t}\n\t\treturn ( nativeClass( value ) === '[object Number]' );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nexport default isNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport toString from './tostring.js'; // eslint-disable-line stdlib/no-redeclare\n\n\n// MAIN //\n\n/**\n* Attempts to serialize a value to a string.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value can be serialized\n*/\nfunction test( value ) {\n\ttry {\n\t\ttoString.call( value );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isPrimitive from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a number\n*\n* @example\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* @example\n* var bool = isNumber( new Number( 3.14 ) );\n* // returns true\n*\n* @example\n* var bool = isNumber( NaN );\n* // returns true\n*\n* @example\n* var bool = isNumber( null );\n* // returns false\n*/\nfunction isNumber( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nexport default isNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// 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 { isPrimitive as isNumber } from '@stdlib/assert-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 '@stdlib/assert-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 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* 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) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Double-precision floating-point positive infinity.\n*\n* @module @stdlib/constants-float64-pinf\n* @type {number}\n*\n* @example\n* import FLOAT64_PINF from '@stdlib/constants-float64-pinf';\n* // returns Infinity\n*/\n\n\n// MAIN //\n\n/**\n* Double-precision floating-point positive infinity.\n*\n* ## Notes\n*\n* Double-precision floating-point positive infinity has the bit sequence\n*\n* ```binarystring\n* 0 11111111111 00000000000000000000 00000000000000000000000000000000\n* ```\n*\n* @constant\n* @type {number}\n* @default Number.POSITIVE_INFINITY\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT64_PINF = Number.POSITIVE_INFINITY; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default FLOAT64_PINF;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Double-precision floating-point negative infinity.\n*\n* @module @stdlib/constants-float64-ninf\n* @type {number}\n*\n* @example\n* import FLOAT64_NINF from '@stdlib/constants-float64-ninf';\n* // returns -Infinity\n*/\n\n// MODULES //\n\nimport Number from '@stdlib/number-ctor';\n\n\n// MAIN //\n\n/**\n* Double-precision floating-point negative infinity.\n*\n* ## Notes\n*\n* Double-precision floating-point negative infinity has the bit sequence\n*\n* ```binarystring\n* 1 11111111111 00000000000000000000 00000000000000000000000000000000\n* ```\n*\n* @constant\n* @type {number}\n* @default Number.NEGATIVE_INFINITY\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT64_NINF = Number.NEGATIVE_INFINITY;\n\n\n// EXPORTS //\n\nexport default FLOAT64_NINF;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// TODO: implementation (?)\n\n/**\n* Rounds a double-precision floating-point number toward negative infinity.\n*\n* @param {number} x - input value\n* @returns {number} rounded value\n*\n* @example\n* var v = floor( -4.2 );\n* // returns -5.0\n*\n* @example\n* var v = floor( 9.99999 );\n* // returns 9.0\n*\n* @example\n* var v = floor( 0.0 );\n* // returns 0.0\n*\n* @example\n* var v = floor( NaN );\n* // returns NaN\n*/\nvar floor = Math.floor; // eslint-disable-line stdlib/no-builtin-math\n\n\n// EXPORTS //\n\nexport default floor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport floor from '@stdlib/math-base-special-floor';\n\n\n// MAIN //\n\n/**\n* Tests if a finite double-precision floating-point number is an integer.\n*\n* @param {number} x - value to test\n* @returns {boolean} boolean indicating whether the value is an integer\n*\n* @example\n* var bool = isInteger( 1.0 );\n* // returns true\n*\n* @example\n* var bool = isInteger( 3.14 );\n* // returns false\n*/\nfunction isInteger( x ) {\n\treturn (floor(x) === x);\n}\n\n\n// EXPORTS //\n\nexport default isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport PINF from '@stdlib/constants-float64-pinf';\nimport NINF from '@stdlib/constants-float64-ninf';\nimport isInt from '@stdlib/math-base-assert-is-integer';\n\n\n// MAIN //\n\n/**\n* Tests if a number primitive is an integer value.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a number primitive is an integer value\n*/\nfunction isInteger( value ) {\n\treturn (\n\t\tvalue < PINF &&\n\t\tvalue > NINF &&\n\t\tisInt( value )\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isNumber } from '@stdlib/assert-is-number';\nimport isInt from './integer.js';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number primitive having an integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number primitive having an integer value\n*\n* @example\n* var bool = isInteger( -3.0 );\n* // returns true\n*\n* @example\n* var bool = isInteger( new Number( -3.0 ) );\n* // returns false\n*/\nfunction isInteger( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tisInt( value )\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isObject as isNumber } from '@stdlib/assert-is-number';\nimport isInt from './integer.js';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object having an integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object having an integer value\n*\n* @example\n* var bool = isInteger( 3.0 );\n* // returns false\n*\n* @example\n* var bool = isInteger( new Number( 3.0 ) );\n* // returns true\n*/\nfunction isInteger( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tisInt( value.valueOf() )\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isPrimitive from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\n/**\n* Tests if a value is an integer.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an integer\n*\n* @example\n* var bool = isInteger( 5.0 );\n* // returns true\n*\n* @example\n* var bool = isInteger( new Number( 5.0 ) );\n* // returns true\n*\n* @example\n* var bool = isInteger( -3.14 );\n* // returns false\n*\n* @example\n* var bool = isInteger( null );\n* // returns false\n*/\nfunction isInteger( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nexport default isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\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// MAIN //\n\n/**\n* Tests if an object's own property is enumerable.\n*\n* @private\n* @name isEnumerableProperty\n* @type {Function}\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object property is enumerable\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = isEnumerableProperty( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = isEnumerableProperty( beep, 'hasOwnProperty' );\n* // returns false\n*/\nvar isEnumerableProperty = Object.prototype.propertyIsEnumerable;\n\n\n// EXPORTS //\n\nexport default isEnumerableProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isEnum from './native.js';\n\n\n// VARIABLES //\n\nvar bool;\n\n\n// FUNCTIONS //\n\n/**\n* Detects whether an environment has a bug where String indices are not detected as \"enumerable\" properties. Observed in Node v0.10.\n*\n* @private\n* @returns {boolean} boolean indicating whether an environment has the bug\n*/\nfunction detect() {\n\treturn !isEnum.call( 'beep', '0' );\n}\n\n\n// MAIN //\n\nbool = detect();\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 isString from '@stdlib/assert-is-string';\nimport { isPrimitive as isnan } from '@stdlib/assert-is-nan';\nimport { isPrimitive as isInteger } from '@stdlib/assert-is-integer';\nimport isEnum from './native.js';\nimport hasStringEnumBug from './has_string_enumerability_bug.js';\n\n\n// MAIN //\n\n/**\n* Tests if an object's own property is enumerable.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object property is enumerable\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = isEnumerableProperty( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = isEnumerableProperty( beep, 'hasOwnProperty' );\n* // returns false\n*/\nfunction isEnumerableProperty( value, property ) {\n\tvar bool;\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\tbool = isEnum.call( value, property );\n\tif ( !bool && hasStringEnumBug && isString( value ) ) {\n\t\t// Note: we only check for indices, as properties attached to a `String` object are properly detected as enumerable above.\n\t\tproperty = +property;\n\t\treturn (\n\t\t\t!isnan( property ) &&\n\t\t\tisInteger( property ) &&\n\t\t\tproperty >= 0 &&\n\t\t\tproperty < value.length\n\t\t);\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default isEnumerableProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\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* Test if a value is an `arguments` object.\n*\n* @module @stdlib/assert-is-arguments\n*\n* @example\n* import isArguments from '@stdlib/assert-is-arguments';\n*\n* function foo() {\n* return arguments;\n* }\n*\n* var bool = isArguments( foo() );\n* // returns true\n*\n* bool = isArguments( [] );\n* // returns false\n*/\n\n// MODULES //\n\nimport hasArgumentsClass from './detect.js';\nimport main from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar isArguments;\nif ( hasArgumentsClass ) {\n\tisArguments = main;\n} else {\n\tisArguments = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default isArguments;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isEnumerableProperty from '@stdlib/assert-is-enumerable-property';\nimport isArray from '@stdlib/assert-is-array';\nimport isInteger from '@stdlib/math-base-assert-is-integer';\nimport MAX_LENGTH from '@stdlib/constants-uint32-max';\n\n\n// MAIN //\n\n/**\n* Tests whether a value is an `arguments` object.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is an `arguments` object\n*\n* @example\n* function foo() {\n* return arguments;\n* }\n*\n* var bool = isArguments( foo() );\n* // returns true\n*\n* @example\n* var bool = isArguments( [] );\n* // returns false\n*/\nfunction isArguments( value ) {\n\treturn (\n\t\tvalue !== null &&\n\t\ttypeof value === 'object' &&\n\t\t!isArray( value ) &&\n\t\ttypeof value.length === 'number' &&\n\t\tisInteger( value.length ) &&\n\t\tvalue.length >= 0 &&\n\t\tvalue.length <= MAX_LENGTH &&\n\t\thasOwnProp( value, 'callee' ) &&\n\t\t!isEnumerableProperty( value, 'callee' )\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isArguments;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isArguments from '@stdlib/assert-is-arguments';\nimport builtin from './builtin.js';\n\n\n// VARIABLES //\n\nvar slice = Array.prototype.slice;\n\n\n// MAIN //\n\n/**\n* Returns an array of an object's own enumerable property names.\n*\n* @private\n* @param {*} value - input object\n* @returns {Array} a list of own enumerable property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var k = keys( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nfunction keys( value ) {\n\tif ( isArguments( value ) ) {\n\t\treturn builtin( slice.call( value ) );\n\t}\n\treturn builtin( value );\n}\n\n\n// EXPORTS //\n\nexport default keys;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isEnumerableProperty from '@stdlib/assert-is-enumerable-property';\nimport noop from '@stdlib/utils-noop';\n\n\n// MAIN //\n\n// Note: certain environments treat an object's prototype as enumerable, which, as a matter of convention, it shouldn't be...\nvar bool = isEnumerableProperty( noop, 'prototype' );\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/**\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// MODULES //\n\nimport isEnumerableProperty from '@stdlib/assert-is-enumerable-property';\n\n\n// VARIABLES //\n\nvar obj = {\n\t'toString': null\n};\n\n\n// MAIN //\n\n// Note: certain environments don't allow enumeration of overwritten properties which are considered non-enumerable...\nvar bool = !isEnumerableProperty( obj, 'toString' );\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/**\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 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) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 whether a value equals the prototype of its constructor.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value equals the prototype of its constructor\n*/\nfunction isConstructorPrototype( value ) {\n\treturn ( value.constructor && value.constructor.prototype === value );\n}\n\n\n// EXPORTS //\n\nexport default isConstructorPrototype;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 w = ( typeof window === 'undefined' ) ? void 0 : window;\n\n\n// EXPORTS //\n\nexport default w;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 indexOf from '@stdlib/utils-index-of';\nimport typeOf from '@stdlib/utils-type-of';\nimport isConstructorPrototype from './is_constructor_prototype.js';\nimport EXCLUDED_KEYS from './excluded_keys.json';\nimport win from './window.js';\n\n\n// VARIABLES //\n\nvar bool;\n\n\n// FUNCTIONS //\n\n/**\n* Determines whether an environment throws when comparing to the prototype of a value's constructor (e.g., [IE9][1]).\n*\n* [1]: https://stackoverflow.com/questions/7688070/why-is-comparing-the-constructor-property-of-two-windows-unreliable\n*\n* @private\n* @returns {boolean} boolean indicating whether an environment is buggy\n*/\nfunction check() {\n\tvar k;\n\tif ( typeOf( win ) === 'undefined' ) {\n\t\treturn false;\n\t}\n\tfor ( k in win ) { // eslint-disable-line guard-for-in\n\t\ttry {\n\t\t\tif (\n\t\t\t\tindexOf( EXCLUDED_KEYS, k ) === -1 &&\n\t\t\t\thasOwnProp( win, k ) &&\n\t\t\t\twin[ k ] !== null &&\n\t\t\t\ttypeOf( win[ k ] ) === 'object'\n\t\t\t) {\n\t\t\t\tisConstructorPrototype( win[ k ] );\n\t\t\t}\n\t\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\n\n// MAIN //\n\nbool = check();\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// MAIN //\n\nvar bool = ( typeof window !== 'undefined' );\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 hasArgumentsBug from './has_arguments_bug.js';\nimport HAS_BUILTIN from './has_builtin.js';\nimport builtin from './builtin.js';\nimport wrapper from './builtin_wrapper.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\n/**\n* Returns an array of an object's own enumerable property names.\n*\n* @name keys\n* @type {Function}\n* @param {*} value - input object\n* @returns {Array} a list of own enumerable property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var k = keys( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nvar keys;\nif ( HAS_BUILTIN ) {\n\tif ( hasArgumentsBug() ) {\n\t\tkeys = wrapper;\n\t} else {\n\t\tkeys = builtin;\n\t}\n} else {\n\tkeys = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default keys;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport keys from './builtin.js';\n\n\n// FUNCTIONS //\n\n/**\n* Tests the built-in `Object.keys()` implementation when provided `arguments`.\n*\n* @private\n* @returns {boolean} boolean indicating whether the built-in implementation returns the expected number of keys\n*/\nfunction test() {\n\treturn ( keys( arguments ) || '' ).length !== 2;\n}\n\n\n// MAIN //\n\n/**\n* Tests whether the built-in `Object.keys()` implementation supports providing `arguments` as an input value.\n*\n* ## Notes\n*\n* - Safari 5.0 does **not** support `arguments` as an input value.\n*\n* @private\n* @returns {boolean} boolean indicating whether a built-in implementation supports `arguments`\n*/\nfunction check() {\n\treturn test( 1, 2 );\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 isObjectLike from '@stdlib/assert-is-object-like';\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport isArguments from '@stdlib/assert-is-arguments';\nimport HAS_ENUM_PROTO_BUG from './has_enumerable_prototype_bug.js';\nimport HAS_NON_ENUM_PROPS_BUG from './has_non_enumerable_properties_bug.js';\nimport isConstructorPrototype from './is_constructor_prototype_wrapper.js';\nimport NON_ENUMERABLE from './non_enumerable.json';\n\n\n// MAIN //\n\n/**\n* Returns an array of an object's own enumerable property names.\n*\n* @private\n* @param {*} value - input object\n* @returns {Array} a list of own enumerable property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var k = keys( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nfunction keys( value ) {\n\tvar skipConstructor;\n\tvar skipPrototype;\n\tvar isFcn;\n\tvar out;\n\tvar k;\n\tvar p;\n\tvar i;\n\n\tout = [];\n\tif ( isArguments( value ) ) {\n\t\t// Account for environments which treat `arguments` differently...\n\t\tfor ( i = 0; i < value.length; i++ ) {\n\t\t\tout.push( i.toString() );\n\t\t}\n\t\t// Note: yes, we are precluding the `arguments` array-like object from having other enumerable properties; however, this should (1) be very rare and (2) not be encouraged (e.g., doing something like `arguments.a = 'b'`; in certain engines directly manipulating the `arguments` value results in automatic de-optimization).\n\t\treturn out;\n\t}\n\tif ( typeof value === 'string' ) {\n\t\t// Account for environments which do not treat string character indices as \"own\" properties...\n\t\tif ( value.length > 0 && !hasOwnProp( value, '0' ) ) {\n\t\t\tfor ( i = 0; i < value.length; i++ ) {\n\t\t\t\tout.push( i.toString() );\n\t\t\t}\n\t\t}\n\t} else {\n\t\tisFcn = ( typeof value === 'function' );\n\t\tif ( isFcn === false && !isObjectLike( value ) ) {\n\t\t\treturn out;\n\t\t}\n\t\tskipPrototype = ( HAS_ENUM_PROTO_BUG && isFcn );\n\t}\n\tfor ( k in value ) {\n\t\tif ( !( skipPrototype && k === 'prototype' ) && hasOwnProp( value, k ) ) {\n\t\t\tout.push( String( k ) );\n\t\t}\n\t}\n\tif ( HAS_NON_ENUM_PROPS_BUG ) {\n\t\tskipConstructor = isConstructorPrototype( value );\n\t\tfor ( i = 0; i < NON_ENUMERABLE.length; i++ ) {\n\t\t\tp = NON_ENUMERABLE[ i ];\n\t\t\tif ( !( skipConstructor && p === 'constructor' ) && hasOwnProp( value, p ) ) {\n\t\t\t\tout.push( String( p ) );\n\t\t\t}\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default keys;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport hasAutomationEqualityBug from './has_automation_equality_bug.js';\nimport isConstructorPrototype from './is_constructor_prototype.js';\nimport HAS_WINDOW from './has_window.js';\n\n\n// MAIN //\n\n/**\n* Wraps the test for constructor prototype equality to accommodate buggy environments (e.g., environments which throw when testing equality).\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value equals the prototype of its constructor\n*/\nfunction wrapper( value ) {\n\tif ( HAS_WINDOW === false && !hasAutomationEqualityBug ) {\n\t\treturn isConstructorPrototype( value );\n\t}\n\ttry {\n\t\treturn isConstructorPrototype( value );\n\t} catch ( error ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default wrapper;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\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 an array of an object's own symbol properties.\n*\n* @module @stdlib/utils-property-symbols\n*\n* @example\n* import getOwnPropertySymbols from '@stdlib/utils-property-symbols';\n*\n* var symbols = getOwnPropertySymbols( {} );\n*/\n\n// MODULES //\n\nimport HAS_BUILTIN from './has_builtin.js';\nimport builtin from './builtin.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( HAS_BUILTIN ) {\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// MAIN //\n\nvar bool = ( typeof Object.getOwnPropertySymbols !== '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\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 Object from '@stdlib/object-ctor';\n\n\n// VARIABLES //\n\nvar propertySymbols = Object.getOwnPropertySymbols;\n\n\n// MAIN //\n\n/**\n* Returns an array of an object's own symbol properties.\n*\n* ## Notes\n*\n* - In contrast to the built-in `Object.getOwnPropertySymbols()`, this function returns an empty array if provided `undefined` or `null`, rather than throwing an error.\n*\n* @private\n* @param {*} value - input object\n* @returns {Array} a list of own symbol properties\n*\n* @example\n* var symbols = getOwnPropertySymbols( {} );\n*/\nfunction getOwnPropertySymbols( value ) {\n\treturn propertySymbols( Object( value ) );\n}\n\n\n// EXPORTS //\n\nexport default getOwnPropertySymbols;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 array of an object's own symbol properties.\n*\n* ## Notes\n*\n* - In contrast to the built-in `Object.getOwnPropertySymbols()`, this function returns an empty array if provided `undefined` or `null`, rather than throwing an error.\n*\n* @private\n* @param {*} value - input object\n* @returns {EmptyArray} a list of own symbol properties\n*\n* @example\n* var symbols = getOwnPropertySymbols( {} );\n* // returns []\n*/\nfunction getOwnPropertySymbols() {\n\treturn [];\n}\n\n\n// EXPORTS //\n\nexport default getOwnPropertySymbols;\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* Copy enumerable own properties from one or more source objects to a target object.\n*\n* @module @stdlib/object-assign\n*\n* @example\n* import assign from '@stdlib/object-assign';\n*\n* var out = assign( {}, { 'foo': 'bar' }, { 'baz': 'beep' } );\n* // returns { 'foo': 'bar', 'baz': 'beep' }\n*/\n\n// MODULES //\n\nimport hasObjectAssign from './has_object_assign.js';\nimport main from './builtin.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar assign;\nif ( hasObjectAssign ) {\n\tassign = main;\n} else {\n\tassign = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default assign;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport keys from '@stdlib/utils-keys';\nimport propertySymbols from '@stdlib/utils-property-symbols';\nimport isEnumerable from '@stdlib/assert-is-enumerable-property';\n\n\n// MAIN //\n\n/**\n* Returns an array of an object's own enumerable property names and symbols.\n*\n* @param {*} value - input object\n* @returns {Array} a list of own property enumerable names and symbols\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var props = enumerableProperties( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nfunction enumerableProperties( value ) {\n\tvar out;\n\tvar tmp;\n\tvar i;\n\n\tout = keys( value );\n\ttmp = propertySymbols( value );\n\tfor ( i = 0; i < tmp.length; i++ ) {\n\t\tif ( isEnumerable( value, tmp[ i ] ) ) {\n\t\t\tout.push( tmp[ i ] );\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default enumerableProperties;\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 enumerableProperties from '@stdlib/utils-enumerable-properties';\nimport Object from '@stdlib/object-ctor';\nimport format from '@stdlib/string-format';\n\n\n// MAIN //\n\n/**\n* Copies own enumerable properties from source objects to a target object.\n*\n* ## Notes\n*\n* - If a property key is present in multiple sources, the property from the last source that defines the key prevails.\n* - The target object is mutated.\n*\n* @param {Object} target - target object\n* @param {...Object} source - source object(s)\n* @throws {TypeError} first argument must not be null or undefined\n* @returns {Object} target object\n*\n* @example\n* var obj1 = {\n* 'a': 'beep'\n* };\n* var obj2 = {\n* 'b': 'boop'\n* };\n*\n* var out = assign( obj1, obj2 );\n* // returns { 'a': 'beep', 'b': 'boop' }\n*/\nfunction assign( target ) {\n\tvar source;\n\tvar keys;\n\tvar key;\n\tvar len;\n\tvar to;\n\tvar i;\n\tvar j;\n\tif ( target === void 0 || target === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a non-null object. Value: `%s`.', target ) );\n\t}\n\tto = Object( target );\n\tfor ( i = 1; i < arguments.length; i++ ) {\n\t\tsource = arguments[ i ];\n\t\tif ( source === void 0 || source === null ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tkeys = enumerableProperties( Object( source ) );\n\t\tlen = keys.length;\n\t\tfor ( j = 0; j < len; j++ ) {\n\t\t\tkey = keys[ j ];\n\t\t\tto[ key ] = source[ key ];\n\t\t}\n\t}\n\treturn to;\n}\n\n\n// EXPORTS //\n\nexport default assign;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport format from '@stdlib/string-format';\n\n\n// MAIN //\n\n/**\n* Tests that a value is a valid constructor.\n*\n* @private\n* @param {*} value - value to test\n* @returns {(Error|null)} error object or null\n*\n* @example\n* var ctor = function ctor() {};\n*\n* var err = validate( ctor );\n* // returns null\n*\n* err = validate( null );\n* // returns \n*/\nfunction validate( value ) {\n\tvar type = typeof value;\n\tif (\n\t\tvalue === null ||\n\t\t(type !== 'object' && type !== 'function')\n\t) {\n\t\treturn new TypeError( format( 'invalid argument. A provided constructor must be either an object (except null) or a function. Value: `%s`.', value ) );\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// EXPORTS //\n\nexport default Object.create;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Dummy constructor.\n*\n* @private\n*/\nfunction Ctor() {\n\t// Empty...\n}\n\n\n// MAIN //\n\n/**\n* An `Object.create` shim for older JavaScript engines.\n*\n* @private\n* @param {Object} proto - prototype\n* @returns {Object} created object\n*\n* @example\n* var obj = createObject( Object.prototype );\n* // returns {}\n*/\nfunction createObject( proto ) {\n\tCtor.prototype = proto;\n\treturn new Ctor();\n}\n\n\n// EXPORTS //\n\nexport default createObject;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 './native.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar createObject;\nif ( typeof builtin === 'function' ) {\n\tcreateObject = builtin;\n} else {\n\tcreateObject = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default createObject;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport defineProperty from '@stdlib/utils-define-property';\nimport format from '@stdlib/string-format';\nimport validate from './validate.js';\nimport createObject from './detect.js';\n\n\n// MAIN //\n\n/**\n* Implements prototypical inheritance by replacing the prototype of one constructor with the prototype of another constructor.\n*\n* ## Notes\n*\n* - This implementation is not designed to work with ES2015/ES6 classes. For ES2015/ES6 classes, use `class` with `extends`.\n* - For reference, see [node#3455](https://github.com/nodejs/node/pull/3455), [node#4179](https://github.com/nodejs/node/issues/4179), [node#3452](https://github.com/nodejs/node/issues/3452), and [node commit](https://github.com/nodejs/node/commit/29da8cf8d7ab8f66b9091ab22664067d4468461e#diff-3deb3f32958bb937ae05c6f3e4abbdf5).\n*\n* @param {(Object|Function)} ctor - constructor which will inherit\n* @param {(Object|Function)} superCtor - super (parent) constructor\n* @throws {TypeError} first argument must be either an object or a function which can inherit\n* @throws {TypeError} second argument must be either an object or a function from which a constructor can inherit\n* @throws {TypeError} second argument must have an inheritable prototype\n* @returns {(Object|Function)} child constructor\n*\n* @example\n* function Foo() {\n* return this;\n* }\n* Foo.prototype.beep = function beep() {\n* return 'boop';\n* };\n*\n* function Bar() {\n* Foo.call( this );\n* return this;\n* }\n* inherit( Bar, Foo );\n*\n* var bar = new Bar();\n* var v = bar.beep();\n* // returns 'boop'\n*/\nfunction inherit( ctor, superCtor ) {\n\tvar err = validate( ctor );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\terr = validate( superCtor );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\tif ( typeof superCtor.prototype === 'undefined' ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must have a prototype from which another object can inherit. Value: `%s`.', superCtor.prototype ) );\n\t}\n\t// Create a prototype which inherits from the parent prototype:\n\tctor.prototype = createObject( superCtor.prototype );\n\n\t// Set the constructor to refer to the child constructor:\n\tdefineProperty( ctor.prototype, 'constructor', {\n\t\t'configurable': true,\n\t\t'enumerable': false,\n\t\t'writable': true,\n\t\t'value': ctor\n\t});\n\n\treturn ctor;\n}\n\n\n// EXPORTS //\n\nexport default inherit;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport defineProperty from '@stdlib/utils-define-property';\n\n\n// MAIN //\n\n/**\n* Defines a non-enumerable 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* import objectKeys from '@stdlib/utils-keys';\n*\n* var obj = {};\n*\n* setNonEnumerableProperty( obj, 'foo', 'bar' );\n*\n* var v = obj.foo;\n* // returns 'bar'\n*\n* var keys = objectKeys( obj );\n* // returns []\n*/\nfunction setNonEnumerableProperty( obj, prop, value ) {\n\tdefineProperty( obj, prop, {\n\t\t'configurable': true,\n\t\t'enumerable': false,\n\t\t'writable': true,\n\t\t'value': value\n\t});\n}\n\n\n// EXPORTS //\n\nexport default setNonEnumerableProperty;\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\nvar proc = require( 'process' );\n\n\n// MAIN //\n\n/**\n* Adds a callback to the \"next tick queue\".\n*\n* ## Notes\n*\n* - The queue is fully drained after the current operation on the JavaScript stack runs to completion and before the event loop is allowed to continue.\n*\n* @param {Callback} clbk - callback\n* @param {...*} [args] - arguments to provide to the callback upon invocation\n*\n* @example\n* function beep() {\n* console.log( 'boop' );\n* }\n*\n* nextTick( beep );\n*/\nfunction nextTick( clbk ) {\n\tvar args;\n\tvar i;\n\n\targs = [];\n\tfor ( i = 1; i < arguments.length; i++ ) {\n\t\targs.push( arguments[ i ] );\n\t}\n\tproc.nextTick( wrapper );\n\n\t/**\n\t* Callback wrapper.\n\t*\n\t* ## Notes\n\t*\n\t* - The ability to provide additional arguments was added in Node.js v1.8.1. The wrapper provides support for earlier Node.js versions.\n\t*\n\t* @private\n\t*/\n\tfunction wrapper() {\n\t\tclbk.apply( null, args );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default nextTick;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\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 '@stdlib/assert-is-object';\nimport isFunction from '@stdlib/assert-is-function';\nimport getPrototypeOf from '@stdlib/utils-get-prototype-of';\nimport hasOwnProp from '@stdlib/assert-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) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isArray from '@stdlib/assert-is-array';\n\n\n// MAIN //\n\n/**\n* Tests if a value is an object; e.g., `{}`.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an object\n*\n* @example\n* var bool = isObject( {} );\n* // returns true\n*\n* @example\n* var bool = isObject( null );\n* // returns false\n*/\nfunction isObject( value ) {\n\treturn (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\t!isArray( value )\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isObject;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isNumber } from '@stdlib/assert-is-number';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number primitive having a nonnegative value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number primitive having a nonnegative number value\n*\n* @example\n* var bool = isNonNegativeNumber( 3.0 );\n* // returns true\n*\n* @example\n* var bool = isNonNegativeNumber( new Number( 3.0 ) );\n* // returns false\n*/\nfunction isNonNegativeNumber( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tvalue >= 0.0\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isNonNegativeNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isObject as isNumber } from '@stdlib/assert-is-number';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object having a nonnegative value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object having a nonnegative number value\n*\n* @example\n* var bool = isNonNegativeNumber( 3.0 );\n* // returns false\n*\n* @example\n* var bool = isNonNegativeNumber( new Number( 3.0 ) );\n* // returns true\n*/\nfunction isNonNegativeNumber( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tvalue.valueOf() >= 0.0\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isNonNegativeNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 number.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a nonnegative number\n*\n* @example\n* var bool = isNonNegativeNumber( 5.0 );\n* // returns true\n*\n* @example\n* var bool = isNonNegativeNumber( new Number( 5.0 ) );\n* // returns true\n*\n* @example\n* var bool = isNonNegativeNumber( 3.14 );\n* // returns true\n*\n* @example\n* var bool = isNonNegativeNumber( -5.0 );\n* // returns false\n*\n* @example\n* var bool = isNonNegativeNumber( null );\n* // returns false\n*/\nfunction isNonNegativeNumber( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nexport default isNonNegativeNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\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 number.\n*\n* @module @stdlib/assert-is-nonnegative-number\n*\n* @example\n* import isNonNegativeNumber from '@stdlib/assert-is-nonnegative-number';\n*\n* var bool = isNonNegativeNumber( 5.0 );\n* // returns true\n*\n* bool = isNonNegativeNumber( new Number( 5.0 ) );\n* // returns true\n*\n* bool = isNonNegativeNumber( 3.14 );\n* // returns true\n*\n* bool = isNonNegativeNumber( -5.0 );\n* // returns false\n*\n* bool = isNonNegativeNumber( null );\n* // returns false\n*\n* @example\n* import { isPrimitive as isNonNegativeNumber } from '@stdlib/assert-is-nonnegative-number';\n*\n* var bool = isNonNegativeNumber( 3.0 );\n* // returns true\n*\n* bool = isNonNegativeNumber( new Number( 3.0 ) );\n* // returns false\n*\n* @example\n* import { isObject as isNonNegativeNumber } from '@stdlib/assert-is-nonnegative-number';\n*\n* var bool = isNonNegativeNumber( 3.0 );\n* // returns false\n*\n* bool = isNonNegativeNumber( 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// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// MAIN //\n\nvar debug = logger( 'inspect-stream' );\n\n\n// EXPORTS //\n\nexport default debug;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar Transform = require( 'readable-stream' ).Transform;\nimport isFunction from '@stdlib/assert-is-function';\nimport assign from '@stdlib/object-assign';\nimport format from '@stdlib/string-format';\nimport inherit from '@stdlib/utils-inherit';\nimport setNonEnumerable from '@stdlib/utils-define-nonenumerable-property';\nimport setNonEnumerableReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport nextTick from '@stdlib/utils-next-tick';\nimport DEFAULTS from './defaults.json';\nimport validate from './validate.js';\nimport debug from './debug.js';\n\n\n// FUNCTIONS //\n\n/**\n* Implements the `_transform` method.\n*\n* @private\n* @param {(Uint8Array|Buffer|string)} chunk - streamed chunk\n* @param {string} encoding - Buffer encoding\n* @param {Callback} clbk - callback to invoke after transforming the streamed chunk\n*/\nfunction transform( chunk, encoding, clbk ) {\n\t/* eslint-disable no-invalid-this */\n\tthis._idx += 1;\n\tdebug( 'Received a new chunk. Chunk: %s. Encoding: %s. Index: %d.', chunk.toString(), encoding, this._idx );\n\tthis._inspect.call( null, chunk, this._idx );\n\tthis.push( chunk );\n\tclbk();\n\n\t/* eslint-enable no-invalid-this */\n}\n\n/**\n* Implements the `_flush` method.\n*\n* @private\n* @param {Callback} clbk - callback to invoke after performing flush tasks\n*/\nfunction flush( clbk ) {\n\tdebug( 'Flushing the stream...' );\n\tclbk();\n}\n\n/**\n* Gracefully destroys a stream, providing backward compatibility.\n*\n* @private\n* @param {Object} [error] - optional error message\n* @returns {InspectStream} stream instance\n*/\nfunction destroy( error ) {\n\t/* eslint-disable no-invalid-this */\n\tvar self;\n\tif ( this._destroyed ) {\n\t\tdebug( 'Attempted to destroy an already destroyed stream.' );\n\t\treturn this;\n\t}\n\tself = this;\n\tthis._destroyed = true;\n\n\tnextTick( close );\n\n\treturn this;\n\n\t/**\n\t* Closes a stream.\n\t*\n\t* @private\n\t*/\n\tfunction close() {\n\t\tif ( error ) {\n\t\t\tdebug( 'Stream was destroyed due to an error. Error: %s.', JSON.stringify( error ) );\n\t\t\tself.emit( 'error', error );\n\t\t}\n\t\tdebug( 'Closing the stream...' );\n\t\tself.emit( 'close' );\n\t}\n\n\t/* eslint-enable no-invalid-this */\n}\n\n\n// MAIN //\n\n/**\n* Inspect stream constructor.\n*\n* @constructor\n* @param {Options} [options] - stream options\n* @param {boolean} [options.objectMode=false] - specifies whether the stream should operate in object mode\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.allowHalfOpen=false] - specifies whether the stream should remain open even if one side ends\n* @param {boolean} [options.readableObjectMode=false] - specifies whether the readable side should be in object mode\n* @param {Callback} clbk - callback to invoke upon receiving data\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} must provide a callback function\n* @returns {InspectStream} inspect stream\n*\n* @example\n* function log( chunk, idx ) {\n* console.log( 'index: %d', idx );\n* console.log( chunk );\n* }\n*\n* var stream = new InspectStream( log );\n*\n* stream.write( 'a' );\n* stream.write( 'b' );\n* stream.write( 'c' );\n*\n* stream.end();\n*\n* // prints: index: 0\n* // prints: a\n* // prints: index: 1\n* // prints: b\n* // prints: index: 2\n* // prints: c\n*/\nfunction InspectStream( options, clbk ) {\n\tvar inspect;\n\tvar opts;\n\tvar err;\n\tif ( !(this instanceof InspectStream) ) {\n\t\tif ( arguments.length > 1 ) {\n\t\t\treturn new InspectStream( options, clbk );\n\t\t}\n\t\treturn new InspectStream( options );\n\t}\n\topts = assign( {}, DEFAULTS );\n\tif ( arguments.length > 1 ) {\n\t\tinspect = clbk;\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t} else {\n\t\tinspect = options;\n\t}\n\tif ( !isFunction( inspect ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Callback argument must be a function. Value: `%s`.', inspect ) );\n\t}\n\t// The stream's writable state should always be in object mode to prevent incoming data from being buffered (concatenated) and thus lose separation...\n\topts.writableObjectMode = true;\n\n\t// Make the stream a Transform stream:\n\tdebug( 'Creating a transform stream configured with the following options: %s.', JSON.stringify( opts ) );\n\tTransform.call( this, opts );\n\n\t// The destruction state:\n\tsetNonEnumerable( this, '_destroyed', false );\n\n\t// Initialize a chunk counter:\n\tsetNonEnumerable( this, '_idx', -1 );\n\n\t// Cache a reference to the inspect callback:\n\tsetNonEnumerableReadOnly( this, '_inspect', inspect );\n\n\treturn this;\n}\n\n/*\n* Inherit from the `Transform` prototype.\n*/\ninherit( InspectStream, Transform );\n\n/**\n* Implements the `_transform` method.\n*\n* @private\n* @name _transform\n* @memberof InspectStream.prototype\n* @type {Function}\n* @param {(Buffer|string)} chunk - streamed chunk\n* @param {string} encoding - Buffer encoding\n* @param {Callback} clbk - callback to invoke after transforming the streamed chunk\n*/\nsetNonEnumerableReadOnly( InspectStream.prototype, '_transform', transform );\n\n/**\n* Implements the `_flush` method.\n*\n* @private\n* @name _flush\n* @memberof InspectStream.prototype\n* @type {Function}\n* @param {Callback} clbk - callback to invoke after performing flush tasks\n*/\nsetNonEnumerableReadOnly( InspectStream.prototype, '_flush', flush );\n\n/**\n* Gracefully destroys a stream, providing backward compatibility.\n*\n* @name destroy\n* @memberof InspectStream.prototype\n* @type {Function}\n* @param {Object} [error] - optional error message\n* @returns {InspectStream} stream instance\n*/\nsetNonEnumerableReadOnly( InspectStream.prototype, 'destroy', destroy );\n\n\n// EXPORTS //\n\nexport default InspectStream;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isNonNegative } from '@stdlib/assert-is-nonnegative-number';\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 {boolean} [options.objectMode] - specifies whether a stream should operate in object mode\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.allowHalfOpen] - specifies whether the stream should remain open even if one side ends\n* @param {boolean} [options.readableObjectMode] - specifies whether the readable side should be in object mode\n* @returns {(Error|null)} null or an error object\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, 'objectMode' ) ) {\n\t\topts.objectMode = options.objectMode;\n\t\tif ( !isBoolean( opts.objectMode ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'objectMode', opts.objectMode ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'readableObjectMode' ) ) {\n\t\topts.readableObjectMode = options.readableObjectMode;\n\t\tif ( !isBoolean( opts.readableObjectMode ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'readableObjectMode', opts.readableObjectMode ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'allowHalfOpen' ) ) {\n\t\topts.allowHalfOpen = options.allowHalfOpen;\n\t\tif ( !isBoolean( opts.allowHalfOpen ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'allowHalfOpen', opts.allowHalfOpen ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'highWaterMark' ) ) {\n\t\topts.highWaterMark = options.highWaterMark;\n\t\tif ( !isNonNegative( opts.highWaterMark ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a nonnegative number. Option: `%s`.', 'highWaterMark', opts.highWaterMark ) );\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/**\n* Transform stream which inspects streamed data.\n*\n* @module @stdlib/streams-node-inspect\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect';\n*\n* function log( chunk, idx ) {\n* console.log( 'index: %d', idx );\n* console.log( chunk );\n* // => index: 0\\na\\nindex: 1\\nb\\nindex: 2\\nc\\n\n* }\n*\n* var stream = inspectStream( log );\n*\n* stream.write( 'a' );\n* stream.write( 'b' );\n* stream.write( 'c' );\n*\n* stream.end();\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect';\n*\n* function log( chunk, idx ) {\n* console.log( 'index: %d', idx );\n* console.log( chunk );\n* // => index: 0\\n{'value': 'a'}\\nindex: 1\\n{'value': 'b'}\\nindex: 2\\n{'value': 'c'}\\n\n* }\n*\n* var stream = inspectStream.objectMode( log );\n*\n* stream.write( {'value': 'a'} );\n* stream.write( {'value': 'b'} );\n* stream.write( {'value': 'c'} );\n*\n* stream.end();\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect';\n*\n* function log( chunk, idx ) {\n* console.log( 'index: %d', idx );\n* console.log( chunk );\n* }\n*\n* var opts = {\n* 'objectMode': true,\n* 'highWaterMark': 64\n* };\n*\n* var factory = inspectStream.factory( opts );\n*\n* // Create 10 identically configured streams...\n* var streams = [];\n* var i;\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( factory( log ) );\n* }\n*/\n\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport objectMode from './object_mode.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'objectMode', objectMode );\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 isObject from '@stdlib/assert-is-plain-object';\nimport format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport Stream from './main.js';\n\n\n// MAIN //\n\n/**\n* Returns an inspect stream with `objectMode` set to `true`.\n*\n* @param {Options} [options] - stream options\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.allowHalfOpen=false] - specifies whether the stream should remain open even if one side ends\n* @param {boolean} [options.readableObjectMode=false] - specifies whether the readable side should be in object mode\n* @param {Callback} clbk - callback to invoke upon receiving data\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} must provide a callback function\n* @returns {InspectStream} inspect stream\n*\n* @example\n* function log( chunk, idx ) {\n* console.log( 'index: %d', idx );\n* console.log( chunk );\n* }\n*\n* var stream = objectMode( log );\n*\n* stream.write( {'value': 'a'} );\n* stream.write( {'value': 'b'} );\n* stream.write( {'value': 'c'} );\n*\n* stream.end();\n*\n* // prints: index: 0\n* // prints: {'value': 'a'}\n* // prints: index: 1\n* // prints: {'value': 'b'}\n* // prints: index: 2\n* // prints: {'value': 'c'}\n*/\nfunction objectMode( options, clbk ) {\n\tvar opts;\n\tvar cb;\n\tif ( arguments.length > 1 ) {\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\topts = assign( {}, options );\n\t\tcb = clbk;\n\t} else {\n\t\topts = {};\n\t\tcb = options;\n\t}\n\topts.objectMode = true;\n\treturn new Stream( opts, cb );\n}\n\n\n// EXPORTS //\n\nexport default objectMode;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport Stream from './main.js';\n\n\n// MAIN //\n\n/**\n* Creates a reusable inspect stream factory.\n*\n* @param {Options} [options] - stream options\n* @param {boolean} [options.objectMode=false] - specifies whether the stream should operate in object mode\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.allowHalfOpen=false] - specifies whether the stream should remain open even if one side ends\n* @param {boolean} [options.readableObjectMode=false] - specifies whether the readable side should be in object mode\n* @throws {TypeError} options argument must be an object\n* @returns {Function} inspect stream factory\n*\n* @example\n* function log( chunk, idx ) {\n* console.log( 'index: %d', idx );\n* console.log( chunk );\n* }\n*\n* var opts = {\n* 'objectMode': true,\n* 'highWaterMark': 64\n* };\n*\n* var factory = streamFactory( opts );\n*\n* // Create 10 identically configured streams...\n* var streams = [];\n* var i;\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( factory( log ) );\n* }\n*/\nfunction streamFactory( options ) {\n\tvar opts;\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\topts = assign( {}, options );\n\t} else {\n\t\topts = {};\n\t}\n\treturn inspectStream;\n\n\t/**\n\t* Creates a transform stream for inspecting streamed data.\n\t*\n\t* @private\n\t* @param {Callback} clbk - callback to invoke upon receiving data\n\t* @throws {TypeError} must provide valid options\n\t* @throws {TypeError} must provide a callback function\n\t* @returns {InspectStream} inspect stream\n\t*/\n\tfunction inspectStream( clbk ) {\n\t\treturn new Stream( opts, clbk );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default streamFactory;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 'debug-stream';\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport NAMESPACE from './namespace.js';\n\n\n// MAIN //\n\nvar debug = logger( NAMESPACE );\n\n\n// EXPORTS //\n\nexport default debug;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isNonNegative } from '@stdlib/assert-is-nonnegative-number';\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.name] - debug namespace\n* @param {boolean} [options.objectMode] - specifies whether a stream should operate in object mode\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.allowHalfOpen] - specifies whether the stream should remain open even if one side ends\n* @param {boolean} [options.readableObjectMode] - specifies whether the readable side should be in object mode\n* @returns {(Error|null)} null or an error object\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, 'name' ) ) {\n\t\topts.name = options.name;\n\t\tif ( !isString( opts.name ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'name', opts.name ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'objectMode' ) ) {\n\t\topts.objectMode = options.objectMode;\n\t\tif ( !isBoolean( opts.objectMode ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'objectMode', opts.objectMode ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'readableObjectMode' ) ) {\n\t\topts.readableObjectMode = options.readableObjectMode;\n\t\tif ( !isBoolean( opts.readableObjectMode ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'readableObjectMode', opts.readableObjectMode ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'allowHalfOpen' ) ) {\n\t\topts.allowHalfOpen = options.allowHalfOpen;\n\t\tif ( !isBoolean( opts.allowHalfOpen ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'allowHalfOpen', opts.allowHalfOpen ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'highWaterMark' ) ) {\n\t\topts.highWaterMark = options.highWaterMark;\n\t\tif ( !isNonNegative( opts.highWaterMark ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a nonnegative number. Option: `%s`.', 'highWaterMark', opts.highWaterMark ) );\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\nvar debug = require( 'debug' );\n\n\n// EXPORTS //\n\nexport default debug;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport InspectStream from '@stdlib/streams-node-inspect';\nimport isFunction from '@stdlib/assert-is-function';\nimport isBuffer from '@stdlib/assert-is-buffer';\nimport format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport inherit from '@stdlib/utils-inherit';\nimport debug from './debug.js';\nimport DEFAULTS from './defaults.json';\nimport NAMESPACE from './namespace.js';\nimport validate from './validate.js';\nimport logger from './logger.js';\n\n\n// MAIN //\n\n/**\n* Debug stream constructor.\n*\n* @constructor\n* @param {Options} [options] - stream options\n* @param {string} [options.name] - debug namespace\n* @param {boolean} [options.objectMode=false] - specifies whether the stream should operate in object mode\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.allowHalfOpen=false] - specifies whether the stream should remain open even if one side ends\n* @param {boolean} [options.readableObjectMode=false] - specifies whether the readable side should be in object mode\n* @param {Callback} [clbk] - callback to invoke upon receiving data\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} must a valid callback argument\n* @returns {DebugStream} debug stream\n*\n* @example\n* var stream = new DebugStream({\n* 'name': 'my-stream'\n* });\n*\n* stream.write( 'a' );\n* stream.write( 'b' );\n* stream.write( 'c' );\n* stream.end();\n*/\nfunction DebugStream( options, clbk ) {\n\tvar opts;\n\tvar name;\n\tvar log;\n\tvar err;\n\tvar cb;\n\tif ( !(this instanceof DebugStream) ) {\n\t\tif ( arguments.length > 1 ) {\n\t\t\treturn new DebugStream( options, clbk );\n\t\t}\n\t\tif ( arguments.length === 1 ) {\n\t\t\treturn new DebugStream( options );\n\t\t}\n\t\treturn new DebugStream();\n\t}\n\topts = assign( {}, DEFAULTS );\n\tif ( arguments.length > 1 ) {\n\t\tif ( !isFunction( clbk ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Callback argument must be a function. Value: `%s`.', clbk ) );\n\t\t}\n\t\tcb = clbk;\n\t\terr = validate( opts, options );\n\t} else if ( arguments.length ) {\n\t\tif ( isFunction( options ) ) {\n\t\t\tcb = options;\n\t\t} else {\n\t\t\terr = validate( opts, options );\n\t\t}\n\t}\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\tif ( opts.name ) {\n\t\tname = NAMESPACE + ':' + opts.name;\n\t} else {\n\t\tname = NAMESPACE;\n\t}\n\tlog = logger( name );\n\n\tdebug( 'Creating a transform stream configured with the following options: %s.', JSON.stringify( opts ) );\n\tInspectStream.call( this, opts, inspect );\n\n\treturn this;\n\n\t/**\n\t* Callback invoked upon receiving a new chunk.\n\t*\n\t* @private\n\t* @param {*} chunk - received chunk\n\t* @param {NonNegativeInteger} idx - chunk index\n\t* @returns {void}\n\t*/\n\tfunction inspect( chunk, idx ) {\n\t\tif ( cb ) {\n\t\t\tdebug( 'Received a new chunk. Chunk: %s. Index: %d.', chunk.toString(), idx );\n\t\t\treturn cb( log, chunk, idx );\n\t\t}\n\t\tif ( isBuffer( chunk ) ) {\n\t\t\tchunk = chunk.toString();\n\t\t}\n\t\tchunk = JSON.stringify( chunk );\n\t\tdebug( 'Received a new chunk. Chunk: %s. Index: %d.', chunk, idx );\n\t\tlog( 'Chunk: %s. Index: %d.', chunk, idx );\n\t}\n}\n\n/*\n* Inherit from the `InspectStream` prototype.\n*/\ninherit( DebugStream, InspectStream );\n\n\n// EXPORTS //\n\nexport default DebugStream;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Transform stream for debugging stream pipelines.\n*\n* @module @stdlib/streams-node-debug\n*\n* @example\n* import debugStream from '@stdlib/streams-node-debug';\n*\n* var stream = debugStream({\n* 'name': 'my-stream'\n* });\n*\n* stream.write( 'a' );\n* stream.write( 'b' );\n* stream.write( 'c' );\n* stream.end();\n*\n* @example\n* import debugStream from '@stdlib/streams-node-debug';\n*\n* var stream = debugStream.objectMode({\n* 'name': 'my-stream'\n* });\n*\n* stream.write( {'value': 'a'} );\n* stream.write( {'value': 'b'} );\n* stream.write( {'value': 'c'} );\n* stream.end();\n*\n* @example\n* import debugStream from '@stdlib/streams-node-debug';\n*\n* var opts = {\n* 'objectMode': true,\n* 'highWaterMark': 64\n* };\n*\n* var factory = debugStream.factory( opts );\n*\n* // Assign each stream to a separate 'debug' namespace...\n* var streams = [];\n* var i;\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( factory( 'stream '+i ) );\n* }\n*/\n\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport objectMode from './object_mode.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'objectMode', objectMode );\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 isFunction from '@stdlib/assert-is-function';\nimport isObject from '@stdlib/assert-is-plain-object';\nimport format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport Stream from './main.js';\n\n\n// MAIN //\n\n/**\n* Returns a debug stream with `objectMode` set to `true`.\n*\n* @param {Options} [options] - stream options\n* @param {string} [options.name] - debug namespace\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.allowHalfOpen=false] - specifies whether the stream should remain open even if one side ends\n* @param {boolean} [options.readableObjectMode=false] - specifies whether the readable side should be in object mode\n* @param {Callback} [clbk] - callback to invoke upon receiving data\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} must provide a valid callback argument\n* @returns {DebugStream} debug stream\n*\n* @example\n* var stream = objectMode({\n* 'name': 'my-stream'\n* });\n*\n* stream.write( {'value': 'a'} );\n* stream.write( {'value': 'b'} );\n* stream.write( {'value': 'c'} );\n* stream.end();\n*/\nfunction objectMode( options, clbk ) {\n\tvar opts;\n\tvar cb;\n\tif ( arguments.length > 1 ) {\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\topts = assign( {}, options );\n\t\tcb = clbk;\n\t\tif ( !isFunction( clbk ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Callback argument must be a function. Value: `%s`.', clbk ) );\n\t\t}\n\t} else if ( arguments.length ) {\n\t\tif ( isFunction( options ) ) {\n\t\t\topts = {};\n\t\t\tcb = options;\n\t\t} else {\n\t\t\tif ( !isObject( options ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t\t\t}\n\t\t\topts = assign( {}, options );\n\t\t}\n\t} else {\n\t\topts = {};\n\t}\n\topts.objectMode = true;\n\tif ( cb === void 0 ) {\n\t\treturn new Stream( opts );\n\t}\n\treturn new Stream( opts, cb );\n}\n\n\n// EXPORTS //\n\nexport default objectMode;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport Stream from './main.js';\n\n\n// MAIN //\n\n/**\n* Creates a reusable debug stream factory.\n*\n* @param {Options} [options] - stream options\n* @param {boolean} [options.objectMode=false] - specifies whether the stream should operate in object mode\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.allowHalfOpen=false] - specifies whether the stream should remain open even if one side ends\n* @param {boolean} [options.readableObjectMode=false] - specifies whether the readable side should be in object mode\n* @throws {TypeError} options argument must be an object\n* @returns {Function} debug stream factory\n*\n* @example\n* var opts = {\n* 'objectMode': true,\n* 'highWaterMark': 64\n* };\n*\n* var factory = streamFactory( opts );\n*\n* // Assign each stream to a separate debug namespace...\n* var streams = [];\n* var i;\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( factory( 'stream '+i ) );\n* }\n*/\nfunction streamFactory( options ) {\n\tvar opts;\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\topts = assign( {}, options );\n\t} else {\n\t\topts = {};\n\t}\n\treturn debugStream;\n\n\t/**\n\t* Creates a transform stream for debugging stream pipelines.\n\t*\n\t* @private\n\t* @param {string} name - debug namespace\n\t* @param {Callback} [clbk] - callback to invoke upon receiving data\n\t* @throws {TypeError} must provide valid options\n\t* @throws {TypeError} must provide a valid callback argument\n\t* @returns {DebugStream} debug stream\n\t*/\n\tfunction debugStream( name, clbk ) {\n\t\topts.name = name;\n\t\tif ( arguments.length > 1 ) {\n\t\t\treturn new Stream( opts, clbk );\n\t\t}\n\t\treturn new Stream( opts );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default streamFactory;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// MAIN //\n\nvar debug = logger( 'inspect-stream-sink' );\n\n\n// EXPORTS //\n\nexport default debug;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar Writable = require( 'readable-stream' ).Writable;\nimport isFunction from '@stdlib/assert-is-function';\nimport assign from '@stdlib/object-assign';\nimport inherit from '@stdlib/utils-inherit';\nimport setNonEnumerable from '@stdlib/utils-define-nonenumerable-property';\nimport setNonEnumerableReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport nextTick from '@stdlib/utils-next-tick';\nimport format from '@stdlib/string-format';\nimport DEFAULTS from './defaults.json';\nimport validate from './validate.js';\nimport debug from './debug.js';\n\n\n// FUNCTIONS //\n\n/**\n* Implements the `_write` method.\n*\n* @private\n* @param {(Uint8Array|Buffer|string)} chunk - streamed chunk\n* @param {string} encoding - Buffer encoding\n* @param {Callback} clbk - callback to invoke after processing the streamed chunk\n* @returns {void}\n*/\nfunction write( chunk, encoding, clbk ) {\n\t/* eslint-disable no-invalid-this */\n\tthis._idx += 1;\n\tdebug( 'Received a new chunk. Chunk: %s. Encoding: %s. Index: %d.', chunk.toString(), encoding, this._idx );\n\tthis._inspect.call( null, chunk, this._idx );\n\n\t// Once destroyed, ensure we do not block the event-loop when an upstream stream pipeline is behaving synchronously (otherwise, by continuing to process stream data synchronously, we'll continue receiving data and the stream will never be destroyed)...\n\tif ( this._destroyed ) {\n\t\treturn nextTick( clbk );\n\t}\n\tclbk();\n\n\t/* eslint-enable no-invalid-this */\n}\n\n/**\n* Gracefully destroys a stream, providing backward compatibility.\n*\n* @private\n* @param {Object} [error] - optional error message\n* @returns {InspectSinkStream} stream instance\n*/\nfunction destroy( error ) {\n\t/* eslint-disable no-invalid-this */\n\tvar self;\n\tif ( this._destroyed ) {\n\t\tdebug( 'Attempted to destroy an already destroyed stream.' );\n\t\treturn this;\n\t}\n\tself = this;\n\tthis._destroyed = true;\n\n\tnextTick( close );\n\n\treturn this;\n\n\t/**\n\t* Closes a stream.\n\t*\n\t* @private\n\t*/\n\tfunction close() {\n\t\tif ( error ) {\n\t\t\tdebug( 'Stream was destroyed due to an error. Error: %s.', JSON.stringify( error ) );\n\t\t\tself.emit( 'error', error );\n\t\t}\n\t\tdebug( 'Closing the stream...' );\n\t\tself.emit( 'close' );\n\t}\n\n\t/* eslint-enable no-invalid-this */\n}\n\n\n// MAIN //\n\n/**\n* Inspect stream constructor.\n*\n* @constructor\n* @param {Options} [options] - stream options\n* @param {boolean} [options.objectMode=false] - specifies whether the stream should operate in object mode\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.decodeStrings=true] - specifies whether to encode strings as `Buffer` objects before writing data to a returned stream\n* @param {string} [options.defaultEncoding='utf8'] - default encoding when not explicitly specified when writing data\n* @param {Callback} clbk - callback to invoke upon receiving data\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} must provide a callback function\n* @returns {InspectSinkStream} inspect stream\n*\n* @example\n* function log( chunk, idx ) {\n* console.log( 'index: %d', idx );\n* console.log( chunk );\n* }\n*\n* var stream = new InspectSinkStream( log );\n*\n* stream.write( 'a' );\n* stream.write( 'b' );\n* stream.write( 'c' );\n*\n* stream.end();\n*\n* // prints: index: 0\n* // prints: a\n* // prints: index: 1\n* // prints: b\n* // prints: index: 2\n* // prints: c\n*/\nfunction InspectSinkStream( options, clbk ) {\n\tvar inspect;\n\tvar opts;\n\tvar err;\n\tif ( !(this instanceof InspectSinkStream) ) {\n\t\tif ( arguments.length > 1 ) {\n\t\t\treturn new InspectSinkStream( options, clbk );\n\t\t}\n\t\treturn new InspectSinkStream( options );\n\t}\n\topts = assign( {}, DEFAULTS );\n\tif ( arguments.length > 1 ) {\n\t\tinspect = clbk;\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t} else {\n\t\tinspect = options;\n\t}\n\tif ( !isFunction( inspect ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Callback argument must be a function. Value: `%s`.', inspect ) );\n\t}\n\t// Make the stream a Writable stream:\n\tdebug( 'Creating a writable stream configured with the following options: %s.', JSON.stringify( opts ) );\n\tWritable.call( this, opts );\n\n\t// The destruction state:\n\tsetNonEnumerable( this, '_destroyed', false );\n\n\t// Initialize a chunk counter:\n\tsetNonEnumerable( this, '_idx', -1 );\n\n\t// Cache a reference to the inspect callback:\n\tsetNonEnumerableReadOnly( this, '_inspect', inspect );\n\n\treturn this;\n}\n\n/*\n* Inherit from the `Writable` prototype.\n*/\ninherit( InspectSinkStream, Writable );\n\n/**\n* Implements the `_write` method.\n*\n* @private\n* @name _write\n* @memberof InspectSinkStream.prototype\n* @type {Function}\n* @param {(Buffer|string)} chunk - streamed chunk\n* @param {string} encoding - Buffer encoding\n* @param {Callback} clbk - callback to invoke after processing the streamed chunk\n*/\nsetNonEnumerableReadOnly( InspectSinkStream.prototype, '_write', write );\n\n/**\n* Gracefully destroys a stream, providing backward compatibility.\n*\n* @name destroy\n* @memberof InspectSinkStream.prototype\n* @type {Function}\n* @param {Object} [error] - optional error message\n* @returns {InspectSinkStream} stream instance\n*/\nsetNonEnumerableReadOnly( InspectSinkStream.prototype, 'destroy', destroy );\n\n\n// EXPORTS //\n\nexport default InspectSinkStream;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 { isPrimitive as isNonNegative } from '@stdlib/assert-is-nonnegative-number';\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 {boolean} [options.objectMode] - specifies whether a stream should operate in object mode\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.decodeStrings] - specifies whether to encode strings as `Buffer` objects before writing data to a returned stream\n* @param {string} [options.defaultEncoding] - default encoding when not explicitly specified when writing data\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'objectMode': true\n* };\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, 'objectMode' ) ) {\n\t\topts.objectMode = options.objectMode;\n\t\tif ( !isBoolean( opts.objectMode ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'objectMode', opts.objectMode ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'highWaterMark' ) ) {\n\t\topts.highWaterMark = options.highWaterMark;\n\t\tif ( !isNonNegative( opts.highWaterMark ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a nonnegative number. Option: `%s`.', 'highWaterMark', opts.highWaterMark ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'decodeStrings' ) ) {\n\t\topts.decodeStrings = options.decodeStrings;\n\t\tif ( !isBoolean( opts.decodeStrings ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'decodeStrings', opts.decodeStrings ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'defaultEncoding' ) ) {\n\t\topts.defaultEncoding = options.defaultEncoding;\n\t\tif ( !isString( opts.defaultEncoding ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'defaultEncoding', opts.defaultEncoding ) );\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/**\n* Writable stream which inspects streamed data.\n*\n* @module @stdlib/streams-node-inspect-sink\n*\n* @example\n* import inspectSinkStream from '@stdlib/streams-node-inspect-sink';\n*\n* function log( chunk, idx ) {\n* console.log( 'index: %d', idx );\n* console.log( chunk );\n* }\n*\n* var stream = inspectSinkStream( log );\n*\n* stream.write( 'a' );\n* stream.write( 'b' );\n* stream.write( 'c' );\n*\n* stream.end();\n*\n* // prints: index: 0\n* // prints: a\n* // prints: index: 1\n* // prints: b\n* // prints: index: 2\n* // prints: c\n*\n* @example\n* import inspectSinkStream from '@stdlib/streams-node-inspect-sink';\n*\n* function log( chunk, idx ) {\n* console.log( 'index: %d', idx );\n* console.log( chunk );\n* }\n*\n* var stream = inspectSinkStream.objectMode( log );\n*\n* stream.write( {'value': 'a'} );\n* stream.write( {'value': 'b'} );\n* stream.write( {'value': 'c'} );\n*\n* stream.end();\n*\n* // prints: index: 0\n* // prints: {'value': 'a'}\n* // prints: index: 1\n* // prints: {'value': 'b'}\n* // prints: index: 2\n* // prints: {'value': 'c'}\n*\n* @example\n* import inspectSinkStream from '@stdlib/streams-node-inspect-sink';\n*\n* function log( chunk, idx ) {\n* console.log( 'index: %d', idx );\n* console.log( chunk );\n* }\n*\n* var opts = {\n* 'objectMode': true,\n* 'highWaterMark': 64\n* };\n*\n* var factory = inspectSinkStream.factory( opts );\n*\n* // Create 10 identically configured streams...\n* var streams = [];\n* var i;\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( factory( log ) );\n* }\n*/\n\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport objectMode from './object_mode.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'objectMode', objectMode );\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 isObject from '@stdlib/assert-is-plain-object';\nimport format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport Stream from './main.js';\n\n\n// MAIN //\n\n/**\n* Returns an inspect stream with `objectMode` set to `true`.\n*\n* @param {Options} [options] - stream options\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.decodeStrings=true] - specifies whether to encode strings as `Buffer` objects before writing data to a returned stream\n* @param {string} [options.defaultEncoding='utf8'] - default encoding when not explicitly specified when writing data\n* @param {Callback} clbk - callback to invoke upon receiving data\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} must provide a callback function\n* @returns {InspectSinkStream} inspect stream\n*\n* @example\n* function log( chunk, idx ) {\n* console.log( 'index: %d', idx );\n* console.log( chunk );\n* }\n*\n* var stream = objectMode( log );\n*\n* stream.write( {'value': 'a'} );\n* stream.write( {'value': 'b'} );\n* stream.write( {'value': 'c'} );\n*\n* stream.end();\n*\n* // prints: 'index: 0'\n* // prints: {'value': 'a'}\n* // prints: 'index: 1'\n* // prints: {'value': 'b'}\n* // prints: 'index: 2'\n* // prints: {'value': 'c'}\n*/\nfunction objectMode( options, clbk ) {\n\tvar opts;\n\tvar cb;\n\tif ( arguments.length > 1 ) {\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\topts = assign( {}, options );\n\t\tcb = clbk;\n\t} else {\n\t\topts = {};\n\t\tcb = options;\n\t}\n\topts.objectMode = true;\n\treturn new Stream( opts, cb );\n}\n\n\n// EXPORTS //\n\nexport default objectMode;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport Stream from './main.js';\n\n\n// MAIN //\n\n/**\n* Creates a reusable inspect stream factory.\n*\n* @param {Options} [options] - stream options\n* @param {boolean} [options.objectMode=false] - specifies whether the stream should operate in object mode\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.decodeStrings=true] - specifies whether to encode strings as `Buffer` objects before writing data to a returned stream\n* @param {string} [options.defaultEncoding='utf8'] - default encoding when not explicitly specified when writing data\n* @throws {TypeError} options argument must be an object\n* @returns {Function} inspect stream factory\n*\n* @example\n* function log( chunk, idx ) {\n* console.log( 'index: %d', idx );\n* console.log( chunk );\n* }\n*\n* var opts = {\n* 'objectMode': true,\n* 'highWaterMark': 64\n* };\n*\n* var factory = streamFactory( opts );\n*\n* // Create 10 identically configured streams...\n* var streams = [];\n* var i;\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( factory( log ) );\n* }\n*/\nfunction streamFactory( options ) {\n\tvar opts;\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\topts = assign( {}, options );\n\t} else {\n\t\topts = {};\n\t}\n\treturn inspectStream;\n\n\t/**\n\t* Creates a writable stream for inspecting streamed data.\n\t*\n\t* @private\n\t* @param {Callback} clbk - callback to invoke upon receiving data\n\t* @throws {TypeError} must provide valid options\n\t* @throws {TypeError} must provide a callback function\n\t* @returns {InspectStream} inspect stream\n\t*/\n\tfunction inspectStream( clbk ) {\n\t\treturn new Stream( opts, clbk );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default streamFactory;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 'debug-stream-sink';\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport NAMESPACE from './namespace.js';\n\n\n// MAIN //\n\nvar debug = logger( NAMESPACE );\n\n\n// EXPORTS //\n\nexport default debug;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isNonNegative } from '@stdlib/assert-is-nonnegative-number';\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.name] - debug namespace\n* @param {boolean} [options.objectMode] - specifies whether a stream should operate in object mode\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.decodeStrings] - specifies whether to encode strings as `Buffer` objects before writing data to a returned stream\n* @param {string} [options.defaultEncoding] - default encoding when not explicitly specified when writing data\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'objectMode': true\n* };\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, 'name' ) ) {\n\t\topts.name = options.name;\n\t\tif ( !isString( opts.name ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'name', opts.name ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'objectMode' ) ) {\n\t\topts.objectMode = options.objectMode;\n\t\tif ( !isBoolean( opts.objectMode ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'objectMode', opts.objectMode ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'highWaterMark' ) ) {\n\t\topts.highWaterMark = options.highWaterMark;\n\t\tif ( !isNonNegative( opts.highWaterMark ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a nonnegative number. Option: `%s`.', 'highWaterMark', opts.highWaterMark ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'decodeStrings' ) ) {\n\t\topts.decodeStrings = options.decodeStrings;\n\t\tif ( !isBoolean( opts.decodeStrings ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'decodeStrings', opts.decodeStrings ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'defaultEncoding' ) ) {\n\t\topts.defaultEncoding = options.defaultEncoding;\n\t\tif ( !isString( opts.defaultEncoding ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'defaultEncoding', opts.defaultEncoding ) );\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\nvar debug = require( 'debug' );\n\n\n// EXPORTS //\n\nexport default debug;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport InspectSinkStream from '@stdlib/streams-node-inspect-sink';\nimport isFunction from '@stdlib/assert-is-function';\nimport isBuffer from '@stdlib/assert-is-buffer';\nimport format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport inherit from '@stdlib/utils-inherit';\nimport debug from './debug.js';\nimport DEFAULTS from './defaults.json';\nimport NAMESPACE from './namespace.js';\nimport validate from './validate.js';\nimport logger from './logger.js';\n\n\n// MAIN //\n\n/**\n* Debug stream constructor.\n*\n* @constructor\n* @param {Options} [options] - stream options\n* @param {string} [options.name] - debug namespace\n* @param {boolean} [options.objectMode=false] - specifies whether the stream should operate in object mode\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.decodeStrings=true] - specifies whether to encode strings as `Buffer` objects before writing data to a returned stream\n* @param {string} [options.defaultEncoding='utf8'] - default encoding when not explicitly specified when writing data\n* @param {Callback} [clbk] - callback to invoke upon receiving data\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} must a valid callback argument\n* @returns {DebugSinkStream} debug stream\n*\n* @example\n* var stream = new DebugSinkStream({\n* 'name': 'my-stream'\n* });\n*\n* stream.write( 'a' );\n* stream.write( 'b' );\n* stream.write( 'c' );\n* stream.end();\n*/\nfunction DebugSinkStream( options, clbk ) {\n\tvar opts;\n\tvar name;\n\tvar log;\n\tvar err;\n\tvar cb;\n\tif ( !(this instanceof DebugSinkStream) ) {\n\t\tif ( arguments.length > 1 ) {\n\t\t\treturn new DebugSinkStream( options, clbk );\n\t\t}\n\t\tif ( arguments.length === 1 ) {\n\t\t\treturn new DebugSinkStream( options );\n\t\t}\n\t\treturn new DebugSinkStream();\n\t}\n\topts = assign( {}, DEFAULTS );\n\tif ( arguments.length > 1 ) {\n\t\tif ( !isFunction( clbk ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Callback argument must be a function. Value: `%s`.', clbk ) );\n\t\t}\n\t\tcb = clbk;\n\t\terr = validate( opts, options );\n\t} else if ( arguments.length ) {\n\t\tif ( isFunction( options ) ) {\n\t\t\tcb = options;\n\t\t} else {\n\t\t\terr = validate( opts, options );\n\t\t}\n\t}\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\tif ( opts.name ) {\n\t\tname = NAMESPACE + ':' + opts.name;\n\t} else {\n\t\tname = NAMESPACE;\n\t}\n\tlog = logger( name );\n\n\tdebug( 'Creating a writable stream configured with the following options: %s.', JSON.stringify( opts ) );\n\tInspectSinkStream.call( this, opts, inspect );\n\n\treturn this;\n\n\t/**\n\t* Callback invoked upon receiving a new chunk.\n\t*\n\t* @private\n\t* @param {*} chunk - received chunk\n\t* @param {NonNegativeInteger} idx - chunk index\n\t* @returns {void}\n\t*/\n\tfunction inspect( chunk, idx ) {\n\t\tif ( cb ) {\n\t\t\tdebug( 'Received a new chunk. Chunk: %s. Index: %d.', chunk.toString(), idx );\n\t\t\treturn cb( log, chunk, idx );\n\t\t}\n\t\tif ( isBuffer( chunk ) ) {\n\t\t\tchunk = chunk.toString();\n\t\t}\n\t\tchunk = JSON.stringify( chunk );\n\t\tdebug( 'Received a new chunk. Chunk: %s. Index: %d.', chunk, idx );\n\t\tlog( 'Chunk: %s. Index: %d.', chunk, idx );\n\t}\n}\n\n/*\n* Inherit from the `InspectSinkStream` prototype.\n*/\ninherit( DebugSinkStream, InspectSinkStream );\n\n\n// EXPORTS //\n\nexport default DebugSinkStream;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport getPrototypeOf from '@stdlib/utils-get-prototype-of';\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// MAIN //\n\n/**\n* Tests if a value is an `Error` object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is an `Error` object\n*\n* @example\n* var bool = isError( new Error( 'beep' ) );\n* // returns true\n*\n* @example\n* var bool = isError( {} );\n* // returns false\n*/\nfunction isError( value ) {\n\tif ( typeof value !== 'object' || value === null ) {\n\t\treturn false;\n\t}\n\t// Check for `Error` objects from the same realm (same Node.js `vm` or same `Window` object)...\n\tif ( value instanceof Error ) {\n\t\treturn true;\n\t}\n\t// Walk the prototype tree until we find an object having the desired native class...\n\twhile ( value ) {\n\t\tif ( nativeClass( value ) === '[object Error]' ) {\n\t\t\treturn true;\n\t\t}\n\t\tvalue = getPrototypeOf( value );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nexport default isError;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Writable stream for debugging stream pipelines.\n*\n* @module @stdlib/streams-node-debug-sink\n*\n* @example\n* import debugSinkStream from '@stdlib/streams-node-debug-sink';\n*\n* var stream = debugSinkStream({\n* 'name': 'my-stream'\n* });\n*\n* stream.write( 'a' );\n* stream.write( 'b' );\n* stream.write( 'c' );\n* stream.end();\n*\n* @example\n* import debugSinkStream from '@stdlib/streams-node-debug-sink';\n*\n* var stream = debugSinkStream.objectMode({\n* 'name': 'my-stream'\n* });\n*\n* stream.write( {'value': 'a'} );\n* stream.write( {'value': 'b'} );\n* stream.write( {'value': 'c'} );\n* stream.end();\n*\n* @example\n* import debugSinkStream from '@stdlib/streams-node-debug-sink';\n*\n* var opts = {\n* 'objectMode': true,\n* 'highWaterMark': 64\n* };\n*\n* var factory = debugSinkStream.factory( opts );\n*\n* // Assign each stream to a separate 'debug' namespace...\n* var streams = [];\n* var i;\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( factory( 'stream '+i ) );\n* }\n*/\n\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport objectMode from './object_mode.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'objectMode', objectMode );\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 isFunction from '@stdlib/assert-is-function';\nimport isObject from '@stdlib/assert-is-plain-object';\nimport format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport Stream from './main.js';\n\n\n// MAIN //\n\n/**\n* Returns a debug stream with `objectMode` set to `true`.\n*\n* @param {Options} [options] - stream options\n* @param {string} [options.name] - debug namespace\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.decodeStrings=true] - specifies whether to encode strings as `Buffer` objects before writing data to a returned stream\n* @param {string} [options.defaultEncoding='utf8'] - default encoding when not explicitly specified when writing data\n* @param {Callback} [clbk] - callback to invoke upon receiving data\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} must provide a valid callback argument\n* @returns {DebugSinkStream} debug stream\n*\n* @example\n* var stream = objectMode({\n* 'name': 'my-stream'\n* });\n*\n* stream.write( {'value': 'a'} );\n* stream.write( {'value': 'b'} );\n* stream.write( {'value': 'c'} );\n* stream.end();\n*/\nfunction objectMode( options, clbk ) {\n\tvar opts;\n\tvar cb;\n\tif ( arguments.length > 1 ) {\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\topts = assign( {}, options );\n\t\tcb = clbk;\n\t\tif ( !isFunction( clbk ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Callback argument must be a function. Value: `%s`.', clbk ) );\n\t\t}\n\t} else if ( arguments.length ) {\n\t\tif ( isFunction( options ) ) {\n\t\t\topts = {};\n\t\t\tcb = options;\n\t\t} else {\n\t\t\tif ( !isObject( options ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t\t\t}\n\t\t\topts = assign( {}, options );\n\t\t}\n\t} else {\n\t\topts = {};\n\t}\n\topts.objectMode = true;\n\tif ( cb === void 0 ) {\n\t\treturn new Stream( opts );\n\t}\n\treturn new Stream( opts, cb );\n}\n\n\n// EXPORTS //\n\nexport default objectMode;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport Stream from './main.js';\n\n\n// MAIN //\n\n/**\n* Creates a reusable debug stream factory.\n*\n* @param {Options} [options] - stream options\n* @param {boolean} [options.objectMode=false] - specifies whether the stream should operate in object mode\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.decodeStrings=true] - specifies whether to encode strings as `Buffer` objects before writing data to a returned stream\n* @param {string} [options.defaultEncoding='utf8'] - default encoding when not explicitly specified when writing data\n* @throws {TypeError} options argument must be an object\n* @returns {Function} debug stream factory\n*\n* @example\n* var opts = {\n* 'objectMode': true,\n* 'highWaterMark': 64\n* };\n*\n* var factory = streamFactory( opts );\n*\n* // Assign each stream to a separate debug namespace...\n* var streams = [];\n* var i;\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( factory( 'stream '+i ) );\n* }\n*/\nfunction streamFactory( options ) {\n\tvar opts;\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\topts = assign( {}, options );\n\t} else {\n\t\topts = {};\n\t}\n\treturn debugStream;\n\n\t/**\n\t* Creates a writable stream for debugging stream pipelines.\n\t*\n\t* @private\n\t* @param {string} name - debug namespace\n\t* @param {Callback} [clbk] - callback to invoke upon receiving data\n\t* @throws {TypeError} must provide valid options\n\t* @throws {TypeError} must provide a valid callback argument\n\t* @returns {DebugStream} debug stream\n\t*/\n\tfunction debugStream( name, clbk ) {\n\t\topts.name = name;\n\t\tif ( arguments.length > 1 ) {\n\t\t\treturn new Stream( opts, clbk );\n\t\t}\n\t\treturn new Stream( opts );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default streamFactory;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// MAIN //\n\nvar debug = logger( 'empty-stream' );\n\n\n// EXPORTS //\n\nexport default debug;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar Readable = require( 'readable-stream' ).Readable;\nimport isError from '@stdlib/assert-is-error';\nimport assign from '@stdlib/object-assign';\nimport inherit from '@stdlib/utils-inherit';\nimport setNonEnumerable from '@stdlib/utils-define-nonenumerable-property';\nimport setNonEnumerableReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport nextTick from '@stdlib/utils-next-tick';\nimport DEFAULTS from './defaults.json';\nimport validate from './validate.js';\nimport debug from './debug.js';\n\n\n// FUNCTIONS //\n\n/**\n* Implements the `_read` method.\n*\n* @private\n* @param {number} size - number (of bytes) to read\n* @returns {void}\n*/\nfunction read() {\n\t/* eslint-disable no-invalid-this */\n\tthis.push( null );\n\n\t/* eslint-enable no-invalid-this */\n}\n\n/**\n* Gracefully destroys a stream, providing backward compatibility.\n*\n* @private\n* @param {(string|Object|Error)} [error] - error\n* @returns {EmptyStream} Stream instance\n*/\nfunction destroy( error ) {\n\t/* eslint-disable no-invalid-this */\n\tvar self;\n\tif ( this._destroyed ) {\n\t\tdebug( 'Attempted to destroy an already destroyed stream.' );\n\t\treturn this;\n\t}\n\tself = this;\n\tthis._destroyed = true;\n\n\tnextTick( close );\n\n\treturn this;\n\n\t/**\n\t* Closes a stream.\n\t*\n\t* @private\n\t*/\n\tfunction close() {\n\t\tif ( error ) {\n\t\t\tdebug( 'Stream was destroyed due to an error. Error: %s.', ( isError( error ) ) ? error.message : JSON.stringify( error ) );\n\t\t\tself.emit( 'error', error );\n\t\t}\n\t\tdebug( 'Closing the stream...' );\n\t\tself.emit( 'close' );\n\t}\n\n\t/* eslint-enable no-invalid-this */\n}\n\n\n// MAIN //\n\n/**\n* Stream constructor for creating an \"empty\" stream.\n*\n* @constructor\n* @param {Options} [options] - stream options\n* @param {boolean} [options.objectMode=false] - specifies whether the stream should operate in object mode\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {EmptyStream} Stream instance\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n*\n* function log( chunk ) {\n* console.log( chunk.toString() );\n* }\n*\n* var stream = new EmptyStream();\n*\n* stream.pipe( inspectStream( log ) );\n*/\nfunction EmptyStream( options ) {\n\tvar opts;\n\tvar err;\n\tif ( !( this instanceof EmptyStream ) ) {\n\t\tif ( arguments.length > 0 ) {\n\t\t\treturn new EmptyStream( options );\n\t\t}\n\t\treturn new EmptyStream();\n\t}\n\topts = assign( {}, DEFAULTS );\n\tif ( arguments.length > 0 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t}\n\t// Make the stream a readable stream:\n\tdebug( 'Creating a readable stream configured with the following options: %s.', JSON.stringify( opts ) );\n\tReadable.call( this, opts );\n\n\t// Destruction state:\n\tsetNonEnumerable( this, '_destroyed', false );\n\n\treturn this;\n}\n\n/*\n* Inherit from the `Readable` prototype.\n*/\ninherit( EmptyStream, Readable );\n\n/**\n* Implements the `_read` method.\n*\n* @private\n* @name _read\n* @memberof EmptyStream.prototype\n* @type {Function}\n* @param {number} size - number (of bytes) to read\n* @returns {void}\n*/\nsetNonEnumerableReadOnly( EmptyStream.prototype, '_read', read );\n\n/**\n* Gracefully destroys a stream, providing backward compatibility.\n*\n* @name destroy\n* @memberof EmptyStream.prototype\n* @type {Function}\n* @param {(string|Object|Error)} [error] - error\n* @returns {EmptyStream} Stream instance\n*/\nsetNonEnumerableReadOnly( EmptyStream.prototype, 'destroy', destroy );\n\n\n// EXPORTS //\n\nexport default EmptyStream;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 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 {boolean} [options.objectMode] - specifies whether a stream should operate in object mode\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'objectMode': true\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, 'objectMode' ) ) {\n\t\topts.objectMode = options.objectMode;\n\t\tif ( !isBoolean( opts.objectMode ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'objectMode', opts.objectMode ) );\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/**\n* Create an \"empty\" readable stream.\n*\n* @module @stdlib/streams-node-empty\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n* import emptyStream from '@stdlib/streams-node-empty';\n*\n* function log( chunk ) {\n* console.log( chunk.toString() );\n* }\n*\n* var stream = emptyStream();\n*\n* stream.pipe( inspectStream( log ) );\n*\n* @example\n* import emptyStream from '@stdlib/streams-node-empty';\n*\n* var opts = {\n* 'objectMode': false\n* };\n*\n* var createStream = emptyStream.factory( opts );\n*\n* // Create 10 identically configured streams...\n* var streams = [];\n* var i;\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( createStream() );\n* }\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n* import emptyStream from '@stdlib/streams-node-empty';\n*\n* function log( v ) {\n* console.log( v );\n* }\n*\n* var stream = emptyStream.objectMode();\n*\n* stream.pipe( inspectStream.objectMode( log ) );\n*/\n\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport objectMode from './object_mode.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'objectMode', objectMode );\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 EmptyStream from './main.js';\n\n\n// MAIN //\n\n/**\n* Returns an \"objectMode\" empty readable stream.\n*\n* @returns {EmptyStream} Stream instance\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n*\n* function log( v ) {\n* console.log( v );\n* }\n*\n* var stream = objectMode();\n*\n* stream.pipe( inspectStream.objectMode( log ) );\n*/\nfunction objectMode() {\n\tvar opts = {\n\t\t'objectMode': true\n\t};\n\treturn new EmptyStream( opts );\n}\n\n\n// EXPORTS //\n\nexport default objectMode;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport EmptyStream from './main.js';\n\n\n// MAIN //\n\n/**\n* Returns a function for creating \"empty\" readable streams.\n*\n* @param {Options} [options] - stream options\n* @param {boolean} [options.objectMode=false] - specifies whether a stream should operate in object mode\n* @throws {TypeError} options argument must be an object\n* @returns {Function} stream factory\n*\n* @example\n* var opts = {\n* 'objectMode': false\n* };\n*\n* var createStream = factory( opts );\n*\n* // Create 10 identically configured streams...\n* var streams = [];\n* var i;\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( createStream() );\n* }\n*/\nfunction factory( options ) {\n\tvar opts;\n\tif ( arguments.length > 0 ) {\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\topts = assign( {}, options );\n\t} else {\n\t\topts = {};\n\t}\n\treturn createStream;\n\n\t/**\n\t* Returns an \"empty\" readable stream.\n\t*\n\t* @private\n\t* @throws {TypeError} options argument must be an object\n\t* @throws {TypeError} must provide valid options\n\t* @returns {EmptyStream} Stream instance\n\t*/\n\tfunction createStream() {\n\t\treturn new EmptyStream( opts );\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// MAIN //\n\nvar ctor = require( 'buffer' ).Buffer; // 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* 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/**\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// 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// MODULES //\n\nimport isFunction from '@stdlib/assert-is-function';\nimport Buffer from '@stdlib/buffer-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 '@stdlib/buffer-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 '@stdlib/buffer-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 ); // eslint-disable-line no-buffer-constructor\n\t}\n\treturn new Buffer( str, 'utf8' ); // eslint-disable-line no-buffer-constructor\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\nvar logger = require( 'debug' );\n\n\n// MAIN //\n\nvar debug = logger( 'from-array-stream' );\n\n\n// EXPORTS //\n\nexport default debug;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar Readable = require( 'readable-stream' ).Readable;\nimport isCollection from '@stdlib/assert-is-collection';\nimport isError from '@stdlib/assert-is-error';\nimport isBuffer from '@stdlib/assert-is-buffer';\nimport format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport inherit from '@stdlib/utils-inherit';\nimport setNonEnumerable from '@stdlib/utils-define-nonenumerable-property';\nimport setNonEnumerableReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport string2buffer from '@stdlib/buffer-from-string';\nimport Buffer from '@stdlib/buffer-ctor'; // TODO: replace Buffer.concat usage with stdlib pkg\nimport nextTick from '@stdlib/utils-next-tick';\nimport DEFAULTS from './defaults.json';\nimport validate from './validate.js';\nimport debug from './debug.js';\n\n\n// FUNCTIONS //\n\n/**\n* Implements the `_read` method.\n*\n* @private\n* @param {number} size - number (of bytes) to read\n* @returns {void}\n*/\nfunction read() {\n\t/* eslint-disable no-invalid-this */\n\tvar FLG;\n\tvar err;\n\tvar v;\n\n\tif ( this._destroyed ) {\n\t\treturn;\n\t}\n\tFLG = true;\n\twhile ( FLG ) {\n\t\terr = null;\n\n\t\tthis._i += 1;\n\t\tif ( this._i > this._src.length ) {\n\t\t\tdebug( 'Finished iteration.' );\n\t\t\treturn this.push( null );\n\t\t}\n\t\tv = this._src[ this._idx ];\n\t\tdebug( 'Value: %s. Idx: %d. Iter: %d.', JSON.stringify( v ), this._idx, this._i );\n\n\t\tthis._idx += this._stride;\n\t\tif ( this._objectMode === false ) {\n\t\t\tv = this._serialize( v );\n\t\t\tif ( typeof v === 'string' ) {\n\t\t\t\tif ( this._i === 1 ) {\n\t\t\t\t\tv = string2buffer( v );\n\t\t\t\t} else {\n\t\t\t\t\tv = string2buffer( this._sep+v );\n\t\t\t\t}\n\t\t\t} else if ( isBuffer( v ) ) {\n\t\t\t\tif ( this._i > 1 ) {\n\t\t\t\t\tv = Buffer.concat( [ string2buffer( this._sep ), v ] );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\terr = new Error( format( 'invalid operation. Serialization function must return a string or Buffer. Value: `%s`.', v ) );\n\t\t\t}\n\t\t}\n\t\tif ( err ) {\n\t\t\tthis.emit( 'error', err );\n\t\t} else {\n\t\t\tFLG = this.push( v );\n\t\t}\n\t}\n\n\t/* eslint-enable no-invalid-this */\n}\n\n/**\n* Gracefully destroys a stream, providing backward compatibility.\n*\n* @private\n* @param {(string|Object|Error)} [error] - error\n* @returns {ArrayStream} Stream instance\n*/\nfunction destroy( error ) {\n\t/* eslint-disable no-invalid-this */\n\tvar self;\n\tif ( this._destroyed ) {\n\t\tdebug( 'Attempted to destroy an already destroyed stream.' );\n\t\treturn this;\n\t}\n\tself = this;\n\tthis._destroyed = true;\n\n\tnextTick( close );\n\n\treturn this;\n\n\t/**\n\t* Closes a stream.\n\t*\n\t* @private\n\t*/\n\tfunction close() {\n\t\tif ( error ) {\n\t\t\tdebug( 'Stream was destroyed due to an error. Error: %s.', ( isError( error ) ) ? error.message : JSON.stringify( error ) );\n\t\t\tself.emit( 'error', error );\n\t\t}\n\t\tdebug( 'Closing the stream...' );\n\t\tself.emit( 'close' );\n\t}\n\n\t/* eslint-enable no-invalid-this */\n}\n\n\n// MAIN //\n\n/**\n* Stream constructor for generating a readable stream from an array-like object.\n*\n* @constructor\n* @param {Collection} src - source array-like object\n* @param {Options} [options] - stream options\n* @param {boolean} [options.objectMode=false] - specifies whether the stream should operate in object mode\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to strings\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the maximum number of bytes to store in an internal buffer before pausing streaming\n* @param {string} [options.sep='\\n'] - separator used to join streamed data\n* @param {Function} [options.serialize] - custom serialization function\n* @param {integer} [options.dir=1] - iteration direction\n* @throws {TypeError} first argument must be an array-like object\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {ArrayStream} Stream instance\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n* import Float64Array from '@stdlib/array-float64';\n* import randu from '@stdlib/random-base-randu';\n*\n* function log( chunk ) {\n* console.log( chunk.toString() );\n* }\n*\n* var arr = new Float64Array( 10 );\n* var i;\n* for ( i = 0; i < arr.length; i++ ) {\n* arr[ i ] = randu();\n* }\n*\n* var stream = new ArrayStream( arr );\n*\n* stream.pipe( inspectStream( log ) );\n*/\nfunction ArrayStream( src, options ) {\n\tvar opts;\n\tvar err;\n\tif ( !( this instanceof ArrayStream ) ) {\n\t\tif ( arguments.length > 1 ) {\n\t\t\treturn new ArrayStream( src, options );\n\t\t}\n\t\treturn new ArrayStream( src );\n\t}\n\tif ( !isCollection( src ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an array-like object. Value: `%s`.', src ) );\n\t}\n\topts = assign( {}, DEFAULTS );\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\t// Make the stream a readable stream:\n\tdebug( 'Creating a readable stream configured with the following options: %s.', JSON.stringify( opts ) );\n\tReadable.call( this, opts );\n\n\t// Destruction state:\n\tsetNonEnumerable( this, '_destroyed', false );\n\n\t// Cache whether the stream is operating in object mode:\n\tsetNonEnumerableReadOnly( this, '_objectMode', opts.objectMode );\n\n\t// Cache the separator:\n\tsetNonEnumerableReadOnly( this, '_sep', opts.sep );\n\n\t// Define the serialization function:\n\tsetNonEnumerableReadOnly( this, '_serialize', opts.serialize || JSON.stringify );\n\n\t// Cache the data source:\n\tsetNonEnumerableReadOnly( this, '_src', src );\n\n\t// Cache the array \"stride\":\n\tsetNonEnumerableReadOnly( this, '_stride', opts.dir );\n\n\t// Initialize an iteration counter:\n\tsetNonEnumerable( this, '_i', 0 );\n\n\t// Initialize the source index (pointer):\n\tsetNonEnumerable( this, '_idx', ( opts.dir === 1 ) ? 0 : src.length-1 );\n\n\treturn this;\n}\n\n/*\n* Inherit from the `Readable` prototype.\n*/\ninherit( ArrayStream, Readable );\n\n/**\n* Implements the `_read` method.\n*\n* @private\n* @name _read\n* @memberof ArrayStream.prototype\n* @type {Function}\n* @param {number} size - number (of bytes) to read\n* @returns {void}\n*/\nsetNonEnumerableReadOnly( ArrayStream.prototype, '_read', read );\n\n/**\n* Gracefully destroys a stream, providing backward compatibility.\n*\n* @name destroy\n* @memberof ArrayStream.prototype\n* @type {Function}\n* @param {(string|Object|Error)} [error] - error\n* @returns {ArrayStream} Stream instance\n*/\nsetNonEnumerableReadOnly( ArrayStream.prototype, 'destroy', destroy );\n\n\n// EXPORTS //\n\nexport default ArrayStream;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isNonNegative } from '@stdlib/assert-is-nonnegative-number';\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport isFunction from '@stdlib/assert-is-function';\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.sep] - separator used to join streamed data\n* @param {boolean} [options.objectMode] - specifies whether a stream should operate in object mode\n* @param {(string|null)} [options.encoding] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the maximum number of bytes to store in the internal buffer before pausing streaming\n* @param {Function} [options.serialize] - custom serialization function\n* @param {integer} [options.dir] - iteration direction\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'objectMode': true\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, 'sep' ) ) {\n\t\topts.sep = options.sep;\n\t\tif ( !isString( opts.sep ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'sep', opts.sep ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'objectMode' ) ) {\n\t\topts.objectMode = options.objectMode;\n\t\tif ( !isBoolean( opts.objectMode ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'objectMode', opts.objectMode ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'encoding' ) ) {\n\t\topts.encoding = options.encoding;\n\t\tif ( !isString( opts.encoding ) && opts.encoding !== null ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a string or null. Option: `%s`.', 'encoding', opts.encoding ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'highWaterMark' ) ) {\n\t\topts.highWaterMark = options.highWaterMark;\n\t\tif ( !isNonNegative( opts.highWaterMark ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a nonnegative number. Option: `%s`.', 'highWaterMark', opts.highWaterMark ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'serialize' ) ) {\n\t\topts.serialize = options.serialize;\n\t\tif ( !isFunction( opts.serialize ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a function. Option: `%s`.', 'serialize', opts.serialize ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'dir' ) ) {\n\t\topts.dir = options.dir;\n\t\tif ( opts.dir !== 1 && opts.dir !== -1 ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be either `1` or `-1`. Option: `%s`.', 'dir', opts.dir ) );\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/**\n* Create a readable stream from an array-like object.\n*\n* @module @stdlib/streams-node-from-array\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n* import Float64Array from '@stdlib/array-float64';\n* import randu from '@stdlib/random-base-randu';\n* import arrayStream from '@stdlib/streams-node-from-array';\n*\n* function log( chunk ) {\n* console.log( chunk.toString() );\n* }\n*\n* var arr = new Float64Array( 10 );\n* var i;\n* for ( i = 0; i < arr.length; i++ ) {\n* arr[ i ] = randu();\n* }\n*\n* var stream = arrayStream( arr );\n*\n* stream.pipe( inspectStream( log ) );\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n* import randu from '@stdlib/random-base-randu';\n* import arrayStream from '@stdlib/streams-node-from-array';\n*\n* var arr = new Float64Array( 10 );\n* var i;\n* for ( i = 0; i < arr.length; i++ ) {\n* arr[ i ] = randu();\n* }\n*\n* var opts = {\n* 'sep': ',',\n* 'objectMode': false,\n* 'encoding': 'utf8',\n* 'highWaterMark': 64\n* };\n*\n* var createStream = arrayStream.factory( opts );\n*\n* // Create 10 identically configured streams...\n* var streams = [];\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( createStream( arr ) );\n* }\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n* import Float64Array from '@stdlib/array-float64';\n* import randu from '@stdlib/random-base-randu';\n* import arrayStream from '@stdlib/streams-node-from-array';\n*\n* function log( v ) {\n* console.log( v );\n* }\n*\n* var arr = new Float64Array( 10 );\n* var i;\n* for ( i = 0; i < arr.length; i++ ) {\n* arr[ i ] = randu();\n* }\n*\n* var stream = arrayStream.objectMode( arr );\n*\n* stream.pipe( inspectStream.objectMode( log ) );\n*/\n\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport objectMode from './object_mode.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'objectMode', objectMode );\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 isObject from '@stdlib/assert-is-plain-object';\nimport format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport ArrayStream from './main.js';\n\n\n// MAIN //\n\n/**\n* Returns an \"objectMode\" readable stream from an array-like object.\n*\n* @param {Collection} src - source array-like object\n* @param {Options} [options] - stream options\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the maximum number of objects to store in an internal buffer before pausing streaming\n* @param {integer} [options.dir=1] - iteration direction\n* @throws {TypeError} first argument must be an array-like object\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {ArrayStream} Stream instance\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n* import Float64Array from '@stdlib/array-float64';\n* import randu from '@stdlib/random-base-randu';\n*\n* function log( v ) {\n* console.log( v );\n* }\n*\n* var arr = new Float64Array( 10 );\n* var i;\n* for ( i = 0; i < arr.length; i++ ) {\n* arr[ i ] = randu();\n* }\n*\n* var stream = objectMode( arr );\n*\n* stream.pipe( inspectStream.objectMode( log ) );\n*/\nfunction objectMode( src, options ) {\n\tvar opts;\n\tif ( arguments.length > 1 ) {\n\t\topts = options;\n\t\tif ( !isObject( opts ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', opts ) );\n\t\t}\n\t\topts = assign( {}, options );\n\t} else {\n\t\topts = {};\n\t}\n\topts.objectMode = true;\n\treturn new ArrayStream( src, opts );\n}\n\n\n// EXPORTS //\n\nexport default objectMode;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport ArrayStream from './main.js';\n\n\n// MAIN //\n\n/**\n* Returns a function for creating readable streams from array-like objects.\n*\n* @param {Options} [options] - stream options\n* @param {boolean} [options.objectMode=false] - specifies whether a stream should operate in object mode\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the maximum number of bytes to store in an internal buffer before pausing streaming\n* @param {string} [options.sep='\\n'] - separator used to join streamed data\n* @param {Function} [options.serialize] - custom serialization function\n* @param {integer} [options.dir=1] - iteration direction\n* @throws {TypeError} options argument must be an object\n* @returns {Function} stream factory\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n* import randu from '@stdlib/random-base-randu';\n*\n* var arr = new Float64Array( 10 );\n* var i;\n* for ( i = 0; i < arr.length; i++ ) {\n* arr[ i ] = randu();\n* }\n*\n* var opts = {\n* 'sep': ',',\n* 'objectMode': false,\n* 'encoding': 'utf8',\n* 'highWaterMark': 64\n* };\n*\n* var createStream = factory( opts );\n*\n* // Create 10 identically configured streams...\n* var streams = [];\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( createStream( arr ) );\n* }\n*/\nfunction factory( options ) {\n\tvar opts;\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\topts = assign( {}, options );\n\t} else {\n\t\topts = {};\n\t}\n\treturn createStream;\n\n\t/**\n\t* Returns a readable stream from an array-like object.\n\t*\n\t* @private\n\t* @param {Collection} src - source array-like object\n\t* @throws {TypeError} must provide an array-like object\n\t* @throws {TypeError} options argument must be an object\n\t* @throws {TypeError} must provide valid options\n\t* @returns {ArrayStream} Stream instance\n\t*/\n\tfunction createStream( src ) {\n\t\treturn new ArrayStream( src, opts );\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 { isPrimitive as isInteger } from '@stdlib/assert-is-integer';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number primitive having a nonnegative integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number primitive having a nonnegative integer value\n*\n* @example\n* var bool = isNonNegativeInteger( 3.0 );\n* // returns true\n*\n* @example\n* var bool = isNonNegativeInteger( new Number( 3.0 ) );\n* // returns false\n*/\nfunction isNonNegativeInteger( value ) {\n\treturn (\n\t\tisInteger( value ) &&\n\t\tvalue >= 0\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isNonNegativeInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isObject as isInteger } from '@stdlib/assert-is-integer';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object having a nonnegative integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object having a nonnegative integer value\n*\n* @example\n* var bool = isNonNegativeInteger( 3.0 );\n* // returns false\n*\n* @example\n* var bool = isNonNegativeInteger( new Number( 3.0 ) );\n* // returns true\n*/\nfunction isNonNegativeInteger( value ) {\n\treturn (\n\t\tisInteger( value ) &&\n\t\tvalue.valueOf() >= 0\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isNonNegativeInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isPrimitive from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a nonnegative integer.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a nonnegative integer\n*\n* @example\n* var bool = isNonNegativeInteger( 5.0 );\n* // returns true\n*\n* @example\n* var bool = isNonNegativeInteger( new Number( 5.0 ) );\n* // returns true\n*\n* @example\n* var bool = isNonNegativeInteger( -5.0 );\n* // returns false\n*\n* @example\n* var bool = isNonNegativeInteger( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isNonNegativeInteger( null );\n* // returns false\n*/\nfunction isNonNegativeInteger( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nexport default isNonNegativeInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Test if a value is 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// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// MAIN //\n\nvar debug = logger( 'from-circular-array-stream' );\n\n\n// EXPORTS //\n\nexport default debug;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar Readable = require( 'readable-stream' ).Readable;\nimport isCollection from '@stdlib/assert-is-collection';\nimport isError from '@stdlib/assert-is-error';\nimport isBuffer from '@stdlib/assert-is-buffer';\nimport assign from '@stdlib/object-assign';\nimport inherit from '@stdlib/utils-inherit';\nimport setNonEnumerable from '@stdlib/utils-define-nonenumerable-property';\nimport setNonEnumerableReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport string2buffer from '@stdlib/buffer-from-string';\nimport Buffer from '@stdlib/buffer-ctor'; // TODO: replace Buffer.concat usage with stdlib pkg\nimport nextTick from '@stdlib/utils-next-tick';\nimport format from '@stdlib/string-format';\nimport DEFAULTS from './defaults.json';\nimport validate from './validate.js';\nimport debug from './debug.js';\n\n\n// FUNCTIONS //\n\n/**\n* Implements the `_read` method.\n*\n* @private\n* @param {number} size - number (of bytes) to read\n* @returns {void}\n*/\nfunction read() {\n\t/* eslint-disable no-invalid-this */\n\tvar FLG;\n\tvar err;\n\tvar v;\n\n\tif ( this._destroyed ) {\n\t\treturn;\n\t}\n\tFLG = true;\n\twhile ( FLG ) {\n\t\terr = null;\n\n\t\tthis._i += 1;\n\t\tif ( this._i > this._iter || this._src.length === 0 ) {\n\t\t\tdebug( 'Finished iteration.' );\n\t\t\treturn this.push( null );\n\t\t}\n\t\tthis._idx += this._stride;\n\t\tif ( this._stride > 0 && this._idx >= this._src.length ) {\n\t\t\tthis._idx %= this._src.length;\n\t\t} else if ( this._stride < 0 && this._idx < 0 ) {\n\t\t\tthis._idx += this._src.length;\n\t\t}\n\t\tv = this._src[ this._idx ];\n\t\tdebug( 'Value: %s. Idx: %d. Iter: %d.', JSON.stringify( v ), this._idx, this._i );\n\n\t\tif ( this._objectMode === false ) {\n\t\t\tv = this._serialize( v );\n\t\t\tif ( typeof v === 'string' ) {\n\t\t\t\tif ( this._i === 1 ) {\n\t\t\t\t\tv = string2buffer( v );\n\t\t\t\t} else {\n\t\t\t\t\tv = string2buffer( this._sep+v );\n\t\t\t\t}\n\t\t\t} else if ( isBuffer( v ) ) {\n\t\t\t\tif ( this._i > 1 ) {\n\t\t\t\t\tv = Buffer.concat( [ string2buffer( this._sep ), v ] );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\terr = new Error( format( 'invalid operation. Serialization function must return a string or Buffer. Value: `%s`.', v ) );\n\t\t\t}\n\t\t}\n\t\tif ( err ) {\n\t\t\tthis.emit( 'error', err );\n\t\t} else {\n\t\t\tFLG = this.push( v );\n\t\t}\n\t}\n\n\t/* eslint-enable no-invalid-this */\n}\n\n/**\n* Gracefully destroys a stream, providing backward compatibility.\n*\n* @private\n* @param {(string|Object|Error)} [error] - error\n* @returns {CircularArrayStream} Stream instance\n*/\nfunction destroy( error ) {\n\t/* eslint-disable no-invalid-this */\n\tvar self;\n\tif ( this._destroyed ) {\n\t\tdebug( 'Attempted to destroy an already destroyed stream.' );\n\t\treturn this;\n\t}\n\tself = this;\n\tthis._destroyed = true;\n\n\tnextTick( close );\n\n\treturn this;\n\n\t/**\n\t* Closes a stream.\n\t*\n\t* @private\n\t*/\n\tfunction close() {\n\t\tif ( error ) {\n\t\t\tdebug( 'Stream was destroyed due to an error. Error: %s.', ( isError( error ) ) ? error.message : JSON.stringify( error ) );\n\t\t\tself.emit( 'error', error );\n\t\t}\n\t\tdebug( 'Closing the stream...' );\n\t\tself.emit( 'close' );\n\t}\n\n\t/* eslint-enable no-invalid-this */\n}\n\n\n// MAIN //\n\n/**\n* Stream constructor for generating a readable stream from an array-like object which repeatedly iterates over a provided value's elements.\n*\n* @constructor\n* @param {Collection} src - source array-like object\n* @param {Options} [options] - stream options\n* @param {boolean} [options.objectMode=false] - specifies whether the stream should operate in object mode\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to strings\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the maximum number of bytes to store in an internal buffer before pausing streaming\n* @param {string} [options.sep='\\n'] - separator used to join streamed data\n* @param {Function} [options.serialize] - custom serialization function\n* @param {NonNegativeInteger} [options.iter=1e308] - number of iterations\n* @param {integer} [options.dir=1] - iteration direction\n* @throws {TypeError} first argument must be an array-like object\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {CircularArrayStream} Stream instance\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n* import Float64Array from '@stdlib/array-float64';\n* import randu from '@stdlib/random-base-randu';\n*\n* function log( chunk ) {\n* console.log( chunk.toString() );\n* }\n*\n* var arr = new Float64Array( 10 );\n* var i;\n* for ( i = 0; i < arr.length; i++ ) {\n* arr[ i ] = randu();\n* }\n*\n* var opts = {\n* 'iter': arr.length * 2\n* };\n*\n* var stream = new CircularArrayStream( arr, opts );\n*\n* stream.pipe( inspectStream( log ) );\n*/\nfunction CircularArrayStream( src, options ) {\n\tvar opts;\n\tvar err;\n\tif ( !( this instanceof CircularArrayStream ) ) {\n\t\tif ( arguments.length > 1 ) {\n\t\t\treturn new CircularArrayStream( src, options );\n\t\t}\n\t\treturn new CircularArrayStream( src );\n\t}\n\tif ( !isCollection( src ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an array-like object. Value: `%s`.', src ) );\n\t}\n\topts = assign( {}, DEFAULTS );\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\t// Make the stream a readable stream:\n\tdebug( 'Creating a readable stream configured with the following options: %s.', JSON.stringify( opts ) );\n\tReadable.call( this, opts );\n\n\t// Destruction state:\n\tsetNonEnumerable( this, '_destroyed', false );\n\n\t// Cache whether the stream is operating in object mode:\n\tsetNonEnumerableReadOnly( this, '_objectMode', opts.objectMode );\n\n\t// Cache the separator:\n\tsetNonEnumerableReadOnly( this, '_sep', opts.sep );\n\n\t// Define the serialization function:\n\tsetNonEnumerableReadOnly( this, '_serialize', opts.serialize || JSON.stringify );\n\n\t// Cache the data source:\n\tsetNonEnumerableReadOnly( this, '_src', src );\n\n\t// Cache the array \"stride\":\n\tsetNonEnumerableReadOnly( this, '_stride', opts.dir );\n\n\t// Cache the number of iterations:\n\tsetNonEnumerableReadOnly( this, '_iter', opts.iter );\n\n\t// Initialize an iteration counter:\n\tsetNonEnumerable( this, '_i', 0 );\n\n\t// Initialize the source index (pointer):\n\tsetNonEnumerable( this, '_idx', ( opts.dir === 1 ) ? -1 : src.length );\n\n\treturn this;\n}\n\n/*\n* Inherit from the `Readable` prototype.\n*/\ninherit( CircularArrayStream, Readable );\n\n/**\n* Implements the `_read` method.\n*\n* @private\n* @name _read\n* @memberof CircularArrayStream.prototype\n* @type {Function}\n* @param {number} size - number (of bytes) to read\n* @returns {void}\n*/\nsetNonEnumerableReadOnly( CircularArrayStream.prototype, '_read', read );\n\n/**\n* Gracefully destroys a stream, providing backward compatibility.\n*\n* @name destroy\n* @memberof CircularArrayStream.prototype\n* @type {Function}\n* @param {(string|Object|Error)} [error] - error\n* @returns {CircularArrayStream} Stream instance\n*/\nsetNonEnumerableReadOnly( CircularArrayStream.prototype, 'destroy', destroy );\n\n\n// EXPORTS //\n\nexport default CircularArrayStream;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isNonNegative } from '@stdlib/assert-is-nonnegative-number';\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert-is-nonnegative-integer';\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport isFunction from '@stdlib/assert-is-function';\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.sep] - separator used to join streamed data\n* @param {boolean} [options.objectMode] - specifies whether a stream should operate in object mode\n* @param {(string|null)} [options.encoding] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the maximum number of bytes to store in the internal buffer before pausing streaming\n* @param {Function} [options.serialize] - custom serialization function\n* @param {NonNegativeInteger} [options.iter=1e308] - number of iterations\n* @param {integer} [options.dir] - iteration direction\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'objectMode': true\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, 'sep' ) ) {\n\t\topts.sep = options.sep;\n\t\tif ( !isString( opts.sep ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'sep', opts.sep ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'objectMode' ) ) {\n\t\topts.objectMode = options.objectMode;\n\t\tif ( !isBoolean( opts.objectMode ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'objectMode', opts.objectMode ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'encoding' ) ) {\n\t\topts.encoding = options.encoding;\n\t\tif ( !isString( opts.encoding ) && opts.encoding !== null ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a string or null. Option: `%s`.', 'encoding', opts.encoding ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'highWaterMark' ) ) {\n\t\topts.highWaterMark = options.highWaterMark;\n\t\tif ( !isNonNegative( opts.highWaterMark ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a nonnegative number. Option: `%s`.', 'highWaterMark', opts.highWaterMark ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'serialize' ) ) {\n\t\topts.serialize = options.serialize;\n\t\tif ( !isFunction( opts.serialize ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a function. Option: `%s`.', 'serialize', opts.serialize ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'iter' ) ) {\n\t\topts.iter = options.iter;\n\t\tif ( !isNonNegativeInteger( opts.iter ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a nonnegative integer. Option: `%s`.', 'iter', opts.iter ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'dir' ) ) {\n\t\topts.dir = options.dir;\n\t\tif ( opts.dir !== 1 && opts.dir !== -1 ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be either `1` or `-1`. Option: `%s`.', 'dir', opts.dir ) );\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/**\n* Create a readable stream from an array-like object which repeatedly iterates over a provided value's elements.\n*\n* @module @stdlib/streams-node-from-circular-array\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n* import Float64Array from '@stdlib/array-float64';\n* import randu from '@stdlib/random-base-randu';\n* import circularArrayStream from '@stdlib/streams-node-from-circular-array';\n*\n* function log( chunk ) {\n* console.log( chunk.toString() );\n* }\n*\n* var arr = new Float64Array( 10 );\n* var i;\n* for ( i = 0; i < arr.length; i++ ) {\n* arr[ i ] = randu();\n* }\n*\n* var opts = {\n* 'iter': arr.length * 2\n* };\n*\n* var stream = circularArrayStream( arr, opts );\n*\n* stream.pipe( inspectStream( log ) );\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n* import randu from '@stdlib/random-base-randu';\n* import circularArrayStream from '@stdlib/streams-node-from-circular-array';\n*\n* var arr = new Float64Array( 10 );\n* var i;\n* for ( i = 0; i < arr.length; i++ ) {\n* arr[ i ] = randu();\n* }\n*\n* var opts = {\n* 'sep': ',',\n* 'objectMode': false,\n* 'encoding': 'utf8',\n* 'highWaterMark': 64\n* };\n*\n* var createStream = circularArrayStream.factory( opts );\n*\n* // Create 10 identically configured streams...\n* var streams = [];\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( createStream( arr ) );\n* }\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n* import Float64Array from '@stdlib/array-float64';\n* import randu from '@stdlib/random-base-randu';\n* import circularArrayStream from '@stdlib/streams-node-from-circular-array';\n*\n* function log( v ) {\n* console.log( v );\n* }\n*\n* var arr = new Float64Array( 10 );\n* var i;\n* for ( i = 0; i < arr.length; i++ ) {\n* arr[ i ] = randu();\n* }\n*\n* var opts = {\n* 'iter': arr.length * 2\n* };\n*\n* var stream = circularArrayStream.objectMode( arr, opts );\n*\n* stream.pipe( inspectStream.objectMode( log ) );\n*/\n\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport objectMode from './object_mode.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'objectMode', objectMode );\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 isObject from '@stdlib/assert-is-plain-object';\nimport format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport CircularArrayStream from './main.js';\n\n\n// MAIN //\n\n/**\n* Returns an \"objectMode\" readable stream from an array-like object which repeatedly iterates over a provided value's elements.\n*\n* @param {Collection} src - source array-like object\n* @param {Options} [options] - stream options\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the maximum number of objects to store in an internal buffer before pausing streaming\n* @param {NonNegativeInteger} [options.iter=1e308] - number of iterations\n* @param {integer} [options.dir=1] - iteration direction\n* @throws {TypeError} first argument must be an array-like object\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {CircularArrayStream} Stream instance\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n* import Float64Array from '@stdlib/array-float64';\n* import randu from '@stdlib/random-base-randu';\n*\n* function log( v ) {\n* console.log( v );\n* }\n*\n* var arr = new Float64Array( 10 );\n* var i;\n* for ( i = 0; i < arr.length; i++ ) {\n* arr[ i ] = randu();\n* }\n*\n* var opts = {\n* 'iter': arr.length * 2\n* };\n*\n* var stream = objectMode( arr, opts );\n*\n* stream.pipe( inspectStream.objectMode( log ) );\n*/\nfunction objectMode( src, options ) {\n\tvar opts;\n\tif ( arguments.length > 1 ) {\n\t\topts = options;\n\t\tif ( !isObject( opts ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', opts ) );\n\t\t}\n\t\topts = assign( {}, options );\n\t} else {\n\t\topts = {};\n\t}\n\topts.objectMode = true;\n\treturn new CircularArrayStream( src, opts );\n}\n\n\n// EXPORTS //\n\nexport default objectMode;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport CircularArrayStream from './main.js';\n\n\n// MAIN //\n\n/**\n* Returns a function for creating readable streams from circular array-like objects.\n*\n* @param {Options} [options] - stream options\n* @param {boolean} [options.objectMode=false] - specifies whether a stream should operate in object mode\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the maximum number of bytes to store in an internal buffer before pausing streaming\n* @param {string} [options.sep='\\n'] - separator used to join streamed data\n* @param {Function} [options.serialize] - custom serialization function\n* @param {integer} [options.iter=1e308] - number of iterations\n* @param {integer} [options.dir=1] - iteration direction\n* @throws {TypeError} options argument must be an object\n* @returns {Function} stream factory\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n* import randu from '@stdlib/random-base-randu';\n*\n* var arr = new Float64Array( 10 );\n* var i;\n* for ( i = 0; i < arr.length; i++ ) {\n* arr[ i ] = randu();\n* }\n*\n* var opts = {\n* 'sep': ',',\n* 'objectMode': false,\n* 'encoding': 'utf8',\n* 'highWaterMark': 64\n* };\n*\n* var createStream = factory( opts );\n*\n* // Create 10 identically configured streams...\n* var streams = [];\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( createStream( arr ) );\n* }\n*/\nfunction factory( options ) {\n\tvar opts;\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\topts = assign( {}, options );\n\t} else {\n\t\topts = {};\n\t}\n\treturn createStream;\n\n\t/**\n\t* Returns a readable stream from a circular array-like object.\n\t*\n\t* @private\n\t* @param {Collection} src - source array-like object\n\t* @throws {TypeError} must provide an array-like object\n\t* @throws {TypeError} options argument must be an object\n\t* @throws {TypeError} must provide valid options\n\t* @returns {CircularArrayStream} Stream instance\n\t*/\n\tfunction createStream( src ) {\n\t\treturn new CircularArrayStream( src, opts );\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 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* 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) 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// VARIABLES //\n\nvar toStr = Object.prototype.toString;\n\n\n// MAIN //\n\n/**\n* Returns the internal class of a provided value.\n*\n* @private\n* @param {*} value - input value\n* @returns {string} internal class\n*/\nfunction toString( value ) { // eslint-disable-line stdlib/no-redeclare\n\treturn toStr.call( value );\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// VARIABLES //\n\nvar Global;\n\n\n// FUNCTIONS //\n\n/**\n* Test if the global scope is bound to the \"global\" variable present in Node.js environments. When creating a new function using the `Function(){}` constructor, the execution scope aliased by the `this` variable is the global scope.\n*\n* @private\n* @returns {boolean} boolean indicating if global scope is bound to \"global\" variable\n*/\nfunction globalScope() {\n\tvar fcn = '';\n\tfcn += 'try {';\n\tfcn += 'return this === global;';\n\tfcn += '} catch ( err ) {';\n\tfcn += 'return false;';\n\tfcn += '}';\n\treturn (new Function( fcn ))(); // eslint-disable-line no-new-func, stdlib/require-globals\n}\n\n\n// MAIN //\n\nGlobal = globalScope();\n\n\n// EXPORTS //\n\nexport default Global;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar proc = require( 'process' );\nimport getGlobal from '@stdlib/utils-global';\nimport nativeClass from '@stdlib/utils-native-class';\nimport isObject from '@stdlib/assert-is-plain-object';\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport toStr from './to_string.js';\nimport globalScope from './global_scope.js';\n\n\n// VARIABLES //\n\nvar Global = getGlobal();\nvar RE = /node|io\\.js/;\n\n\n// MAIN //\n\n/**\n* Returns a boolean indicating if the runtime is Node.js.\n*\n* @returns {boolean} boolean indicating if runtime is Node.js\n*\n* @example\n* var bool = isNode();\n* // returns \n*/\nfunction isNode() {\n\treturn (\n\t\t// Check for presence of `global` variable:\n\t\ttypeof global === 'object' &&\n\n\t\t// Check that the `global` variable matches the determined global variable:\n\t\tglobal === Global &&\n\n\t\t// Check for a circular reference to the global variable:\n\t\tGlobal === Global.global &&\n\n\t\t// Check that the global variable has the expected internal class:\n\t\t(\n\t\t\t// Node < v7\n\t\t\tnativeClass( Global ) === '[object global]' ||\n\n\t\t\t// Node >= v7 (https://github.com/nodejs/node/issues/9274)\n\t\t\tnativeClass( Global ) === '[object Object]'\n\t\t) &&\n\n\t\t// Check that the `global` variable is equal to the global scope:\n\t\tglobalScope === true &&\n\n\t\t// Check for a `require` global variable:\n\t\ttypeof require === 'function' &&\n\n\t\t// Check for a `process` global variable:\n\t\ttypeof proc === 'object' &&\n\n\t\t// Check that the `process` global variable has the expected internal class (NOTE: we use `toStr`, rather than `nativecClass` to address changes introduced in Node >= v14.6.0; see https://github.com/stdlib-js/stdlib/issues/375):\n\t\ttoStr( proc ) === '[object process]' &&\n\n\t\t// Check for a `versions` property:\n\t\tisObject( proc.versions ) &&\n\n\t\t// Check for a `node` property:\n\t\tisString( proc.versions.node ) &&\n\n\t\t/* eslint-disable node/no-unsupported-features/es-builtins */\n\t\t(\n\t\t\t// `process.release` was added in Node v3.0.0 via io.js:\n\t\t\ttypeof proc.release === 'undefined' ||\n\n\t\t\t(\n\t\t\t\t// Check for a `release` property:\n\t\t\t\tisObject( proc.release ) &&\n\n\t\t\t\t// Check for a `name` property:\n\t\t\t\tisString( proc.release.name ) &&\n\n\t\t\t\t// Check that the release name contains either `node` or `io.js` (in Node.js/io.js, the release name is read-only):\n\t\t\t\tRE.test( proc.release.name )\n\t\t\t)\n\t\t)\n\t\t/* eslint-enable node/no-unsupported-features/es-builtins */\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isNode;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Boolean indicating if the runtime is Node.js.\n*\n* @module @stdlib/assert-is-node\n*\n* @example\n* import IS_NODE from '@stdlib/assert-is-node';\n*\n* var bool = IS_NODE;\n* // returns \n*/\n\n// MODULES //\n\nimport main from './main.js';\n\n\n// MAIN //\n\nvar bool = main();\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/**\n* Node version.\n*\n* @module @stdlib/process-node-version\n*\n* @example\n* var semver = require( 'semver' );\n* import VERSION from '@stdlib/process-node-version';\n*\n* if ( semver.lt( VERSION, '1.0.0' ) ) {\n* console.log( 'Running on a pre-io.js version...' );\n* }\n* else if ( semver.lt( VERSION, '4.0.0' ) ) {\n* console.log( 'Running on an io.js version...' );\n* }\n* else {\n* console.log( 'Running on a post-io.js version...' );\n* }\n*/\n\n// MODULES //\n\nimport IS_NODE from '@stdlib/assert-is-node';\nimport node from './main.js';\nimport browser from './browser.js';\n\n\n// MAIN //\n\nvar VERSION;\nif ( IS_NODE ) {\n\tVERSION = node;\n} else {\n\tVERSION = browser;\n}\n\n\n// EXPORTS //\n\nexport default VERSION;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport proc from './process.js';\n\n\n// MAIN //\n\n/**\n* Node version.\n*\n* @constant\n* @type {string}\n*/\nvar VERSION = proc.versions.node;\n\n\n// EXPORTS //\n\nexport default VERSION;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar proc = require( 'process' );\n\n\n// EXPORTS //\n\nexport default proc;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport NODE_VERSION from '@stdlib/process-node-version';\n\n\n// MAIN //\n\nvar MAJOR = ( NODE_VERSION ) ? parseInt( NODE_VERSION.split( '.' )[ 0 ], 10 ) : -1;\n\n\n// EXPORTS //\n\nexport default MAJOR;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 null;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 '@stdlib/buffer-ctor';\nimport version from './node_version.js';\n\n\n// MAIN //\n\nvar bool = isFunction( Buffer.from ) && version >= 5;\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 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/**\n* Maximum unsigned 8-bit integer.\n*\n* @module @stdlib/constants-uint8-max\n* @type {integer32}\n*\n* @example\n* import UINT8_MAX from '@stdlib/constants-uint8-max';\n* // returns 255\n*/\n\n\n// MAIN //\n\n/**\n* Maximum unsigned 8-bit integer.\n*\n* ## Notes\n*\n* The number has the value\n*\n* ```tex\n* 2^{8} - 1\n* ```\n*\n* which corresponds to the bit sequence\n*\n* ```binarystring\n* 11111111\n* ```\n*\n* @constant\n* @type {integer32}\n* @default 255\n*/\nvar UINT8_MAX = 255|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default UINT8_MAX;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\nvar main = ( typeof Uint8Array === 'function' ) ? Uint8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\nvar ctor = ( typeof Uint8Array === 'function' ) ? Uint8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Typed array constructor which returns a typed array representing an array of 8-bit unsigned integers in the platform byte order.\n*\n* @module @stdlib/array-uint8\n*\n* @example\n* import ctor from '@stdlib/array-uint8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasUint8ArraySupport from '@stdlib/assert-has-uint8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasUint8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isUint8Array from '@stdlib/assert-is-uint8array';\nimport UINT8_MAX from '@stdlib/constants-uint8-max';\nimport GlobalUint8Array from './uint8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Uint8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Uint8Array` support\n*\n* @example\n* var bool = hasUint8ArraySupport();\n* // returns \n*/\nfunction hasUint8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalUint8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = [ 1, 3.14, -3.14, UINT8_MAX+1, UINT8_MAX+2 ];\n\t\tarr = new GlobalUint8Array( arr );\n\t\tbool = (\n\t\t\tisUint8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === UINT8_MAX-2 && // truncation and wrap around\n\t\t\tarr[ 3 ] === 0 && // wrap around\n\t\t\tarr[ 4 ] === 1 // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasUint8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of 8-bit unsigned integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\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 using an octet array.\n*\n* @module @stdlib/buffer-from-array\n*\n* @example\n* import array2buffer from '@stdlib/buffer-from-array';\n*\n* var buf = array2buffer( [ 1, 2, 3, 4 ] );\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 array2buffer;\nif ( hasFrom ) {\n\tarray2buffer = main;\n} else {\n\tarray2buffer = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default array2buffer;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\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 from an `ArrayBuffer`.\n*\n* @module @stdlib/buffer-from-arraybuffer\n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n* import arraybuffer2buffer from '@stdlib/buffer-from-arraybuffer';\n*\n* var ab = new ArrayBuffer( 10 );\n* var buf = arraybuffer2buffer( ab );\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 arraybuffer2buffer;\nif ( hasFrom ) {\n\tarraybuffer2buffer = main;\n} else {\n\tarraybuffer2buffer = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default arraybuffer2buffer;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 '@stdlib/buffer-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 isCollection from '@stdlib/assert-is-collection';\nimport format from '@stdlib/string-format';\nimport Buffer from '@stdlib/buffer-ctor';\n\n\n// MAIN //\n\n/**\n* Allocates a buffer using an octet array.\n*\n* @param {Collection} arr - octet array\n* @throws {TypeError} must provide an array-like object\n* @returns {Buffer} new `Buffer` instance\n*\n* @example\n* import fromArray from '@stdlib/buffer-from-array';\n*\n* var buf = fromArray( [ 1, 2, 3, 4 ] );\n* // returns \n*/\nfunction fromArray( arr ) {\n\tif ( !isCollection( arr ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide an array-like object. Value: `%s`.', arr ) );\n\t}\n\treturn Buffer.from( arr );\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// MODULES //\n\nimport isCollection from '@stdlib/assert-is-collection';\nimport format from '@stdlib/string-format';\nimport Buffer from '@stdlib/buffer-ctor';\n\n\n// MAIN //\n\n/**\n* Allocates a buffer using an octet array.\n*\n* @param {Collection} arr - octet array\n* @throws {TypeError} must provide an array-like object\n* @returns {Buffer} new `Buffer` instance\n*\n* @example\n* import fromArray from '@stdlib/buffer-from-array';\n*\n* var buf = fromArray( [ 1, 2, 3, 4 ] );\n* // returns \n*/\nfunction fromArray( arr ) {\n\tif ( !isCollection( arr ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide an array-like object. Value: `%s`.', arr ) );\n\t}\n\treturn new Buffer( arr ); // eslint-disable-line no-buffer-constructor\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// MODULES //\n\nimport isArrayBuffer from '@stdlib/assert-is-arraybuffer';\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert-is-nonnegative-integer';\nimport Buffer from '@stdlib/buffer-ctor';\nimport format from '@stdlib/string-format';\nimport version from './node_version.js';\n\n\n// MAIN //\n\n/**\n* Allocates a buffer from an `ArrayBuffer`.\n*\n* ## Notes\n*\n* The behavior of this function varies across Node.js versions due to changes in the underlying Node.js APIs:\n*\n* - `<6.0.0`: if provided an empty ArrayBuffer, the function returns an empty Buffer which is **not** an ArrayBuffer view.\n* - otherwise, the function returns a view of an ArrayBuffer without copying the underlying memory.\n*\n* @param {ArrayBuffer} buf - ArrayBuffer instance\n* @param {NonNegativeInteger} [byteOffset=0] - index specifying the location of the first buffer byte\n* @param {NonNegativeInteger} [length=buf.byteLength] - number of buffer bytes\n* @throws {TypeError} first argument must be an ArrayBuffer\n* @throws {TypeError} second argument must be a nonnegative integer\n* @throws {RangeError} second argument must not exceed number of bytes in input ArrayBuffer\n* @throws {TypeError} last argument must be a nonnegative integer\n* @throws {RangeError} last argument must not exceed number of bytes in input ArrayBuffer\n* @returns {Buffer} new `Buffer` instance\n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n* var ab = new ArrayBuffer( 10 );\n*\n* var buf = fromArrayBuffer( ab );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n* var ab = new ArrayBuffer( 10 );\n*\n* var buf = fromArrayBuffer( ab, 2, 4 );\n* // returns \n*/\nfunction fromArrayBuffer( buf, byteOffset, length ) {\n\tvar offset;\n\tvar len;\n\tif ( !isArrayBuffer( buf ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an ArrayBuffer. Value: `%s`.', buf ) );\n\t}\n\tif ( arguments.length > 1 ) {\n\t\tif ( !isNonNegativeInteger( byteOffset ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', byteOffset ) );\n\t\t}\n\t\tif ( byteOffset > buf.byteLength ) {\n\t\t\tthrow new RangeError( format( 'invalid argument. Second argument must not exceed the number of bytes in the input ArrayBuffer. Value: `%s`.', byteOffset ) );\n\t\t}\n\t\toffset = byteOffset;\n\t\tif ( arguments.length > 2 ) {\n\t\t\tif ( !isNonNegativeInteger( length ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a nonnegative integer. Value: `%s`.', length ) );\n\t\t\t}\n\t\t\tif ( length > buf.byteLength ) {\n\t\t\t\tthrow new RangeError( format( 'invalid argument. Last argument must not exceed the number of bytes in the input ArrayBuffer. Value: `%s`.', length ) );\n\t\t\t}\n\t\t\tlen = length;\n\t\t} else {\n\t\t\tlen = buf.byteLength - offset;\n\t\t}\n\t} else {\n\t\toffset = 0;\n\t\tlen = buf.byteLength;\n\t}\n\t// Address Node v5.x where providing an empty ArrayBuffer throws an error:\n\tif ( len === 0 && version < 6 ) {\n\t\treturn Buffer.from( [] );\n\t}\n\treturn Buffer.from( buf, offset, len );\n}\n\n\n// EXPORTS //\n\nexport default fromArrayBuffer;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isArrayBuffer from '@stdlib/assert-is-arraybuffer';\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert-is-nonnegative-integer';\nimport Buffer from '@stdlib/buffer-ctor';\nimport Uint8Array from '@stdlib/array-uint8';\nimport fromArray from '@stdlib/buffer-from-array';\nimport format from '@stdlib/string-format';\nimport version from './node_version.js';\n\n\n// MAIN //\n\n/**\n* Allocates a buffer from an `ArrayBuffer`.\n*\n* ## Notes\n*\n* The behavior of this function varies across Node.js versions due to changes in the underlying Node.js APIs:\n*\n* - `<3.0.0`: the function copies ArrayBuffer bytes to a new Buffer instance.\n* - `>=3.0.0`: if provided a byte offset, the function copies `ArrayBuffer` bytes to a new `Buffer` instance; otherwise, the function returns a view of an `ArrayBuffer` without copying the underlying memory.\n* - `<6.0.0`: if provided an empty ArrayBuffer, the function returns an empty Buffer which is **not** an ArrayBuffer view.\n*\n* @param {ArrayBuffer} buf - ArrayBuffer instance\n* @param {NonNegativeInteger} [byteOffset=0] - index specifying the location of the first buffer byte\n* @param {NonNegativeInteger} [length=buf.byteLength] - number of buffer bytes\n* @throws {TypeError} first argument must be an ArrayBuffer\n* @throws {TypeError} second argument must be a nonnegative integer\n* @throws {RangeError} second argument must not exceed number of bytes in input ArrayBuffer\n* @throws {TypeError} last argument must be a nonnegative integer\n* @throws {RangeError} last argument must not exceed number of bytes in input ArrayBuffer\n* @returns {Buffer} new `Buffer` instance\n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n* var ab = new ArrayBuffer( 10 );\n*\n* var buf = fromArrayBuffer( ab );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n* var ab = new ArrayBuffer( 10 );\n*\n* var buf = fromArrayBuffer( ab, 2, 4 );\n* // returns \n*/\nfunction fromArrayBuffer( buf, byteOffset, length ) {\n\tvar len;\n\tif ( !isArrayBuffer( buf ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an ArrayBuffer. Value: `%s`.', buf ) );\n\t}\n\tif ( arguments.length > 1 ) {\n\t\tif ( !isNonNegativeInteger( byteOffset ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', byteOffset ) );\n\t\t}\n\t\tif ( byteOffset > buf.byteLength ) {\n\t\t\tthrow new RangeError( format( 'invalid argument. Second argument must not exceed the number of bytes in the input ArrayBuffer. Value: `%s`.', byteOffset ) );\n\t\t}\n\t\tif ( arguments.length > 2 ) {\n\t\t\tif ( !isNonNegativeInteger( length ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a nonnegative integer. Value: `%s`.', length ) );\n\t\t\t}\n\t\t\tif ( length > buf.byteLength ) {\n\t\t\t\tthrow new RangeError( format( 'invalid argument. Last argument must not exceed the number of bytes in the input ArrayBuffer. Value: `%s`.', length ) );\n\t\t\t}\n\t\t\tlen = length;\n\t\t} else {\n\t\t\tlen = buf.byteLength - byteOffset;\n\t\t}\n\t\treturn fromArray( new Uint8Array( buf, byteOffset, len ) );\n\t}\n\tif ( version < 3 ) {\n\t\treturn fromArray( new Uint8Array( buf ) );\n\t}\n\t// Address Node <= v5.x where providing an empty ArrayBuffer throws an error:\n\tif ( buf.byteLength === 0 ) {\n\t\treturn new Buffer( [] );\n\t}\n\treturn new Buffer( buf );\n}\n\n\n// EXPORTS //\n\nexport default fromArrayBuffer;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// MAIN //\n\nvar debug = logger( 'from-constant-stream' );\n\n\n// EXPORTS //\n\nexport default debug;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar Readable = require( 'readable-stream' ).Readable;\nimport isError from '@stdlib/assert-is-error';\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport isBuffer from '@stdlib/assert-is-buffer';\nimport isUint8Array from '@stdlib/assert-is-uint8array';\nimport arraybuffer2buffer from '@stdlib/buffer-from-arraybuffer';\nimport string2buffer from '@stdlib/buffer-from-string';\nimport Buffer from '@stdlib/buffer-ctor'; // TODO: replace Buffer.concat usage with stdlib pkg\nimport assign from '@stdlib/object-assign';\nimport format from '@stdlib/string-format';\nimport inherit from '@stdlib/utils-inherit';\nimport setNonEnumerable from '@stdlib/utils-define-nonenumerable-property';\nimport setNonEnumerableReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport nextTick from '@stdlib/utils-next-tick';\nimport DEFAULTS from './defaults.json';\nimport validate from './validate.js';\nimport debug from './debug.js';\n\n\n// FUNCTIONS //\n\n/**\n* Implements the `_read` method.\n*\n* @private\n* @param {number} size - number (of bytes) to read\n* @returns {void}\n*/\nfunction read() {\n\t/* eslint-disable no-invalid-this */\n\tvar FLG;\n\tif ( this._destroyed ) {\n\t\treturn;\n\t}\n\tFLG = true;\n\twhile ( FLG ) {\n\t\tthis._i += 1;\n\t\tif ( this._i > this._iter ) {\n\t\t\tdebug( 'Finished iteration.' );\n\t\t\treturn this.push( null );\n\t\t}\n\t\tdebug( 'Value: %s. Iter: %d.', this._value, this._i );\n\t\tif ( this._objectMode === false && this._i > 1 ) {\n\t\t\tFLG = this.push( Buffer.concat( [ this._sep, this._value ] ) );\n\t\t} else {\n\t\t\tFLG = this.push( this._value );\n\t\t}\n\t}\n\n\t/* eslint-enable no-invalid-this */\n}\n\n/**\n* Gracefully destroys a stream, providing backward compatibility.\n*\n* @private\n* @param {(string|Object|Error)} [error] - error\n* @returns {ConstantStream} Stream instance\n*/\nfunction destroy( error ) {\n\t/* eslint-disable no-invalid-this */\n\tvar self;\n\tif ( this._destroyed ) {\n\t\tdebug( 'Attempted to destroy an already destroyed stream.' );\n\t\treturn this;\n\t}\n\tself = this;\n\tthis._destroyed = true;\n\n\tnextTick( close );\n\n\treturn this;\n\n\t/**\n\t* Closes a stream.\n\t*\n\t* @private\n\t*/\n\tfunction close() {\n\t\tif ( error ) {\n\t\t\tdebug( 'Stream was destroyed due to an error. Error: %s.', ( isError( error ) ) ? error.message : JSON.stringify( error ) );\n\t\t\tself.emit( 'error', error );\n\t\t}\n\t\tdebug( 'Closing the stream...' );\n\t\tself.emit( 'close' );\n\t}\n\n\t/* eslint-enable no-invalid-this */\n}\n\n\n// MAIN //\n\n/**\n* Stream constructor for generating a stream which always streams the same value.\n*\n* @constructor\n* @param {(string|Buffer|Uint8Array)} value - value to stream\n* @param {Options} [options] - stream options\n* @param {boolean} [options.objectMode=false] - specifies whether the stream should operate in object mode\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to strings\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the maximum number of bytes to store in an internal buffer before pausing streaming\n* @param {string} [options.sep='\\n'] - separator used to join streamed data\n* @param {NonNegativeInteger} [options.iter] - number of iterations\n* @throws {TypeError} in binary mode, value to stream must be a string, `Buffer`, or `Uint8Array`\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {ConstantStream} Stream instance\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n*\n* function log( chunk ) {\n* console.log( chunk.toString() );\n* }\n*\n* var opts = {\n* 'iter': 10\n* };\n*\n* var stream = new ConstantStream( 'beep', opts );\n*\n* stream.pipe( inspectStream( log ) );\n*/\nfunction ConstantStream( value, options ) {\n\tvar opts;\n\tvar err;\n\tif ( !( this instanceof ConstantStream ) ) {\n\t\tif ( arguments.length > 1 ) {\n\t\t\treturn new ConstantStream( value, options );\n\t\t}\n\t\treturn new ConstantStream( value );\n\t}\n\topts = assign( {}, DEFAULTS );\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 ( opts.objectMode === false ) {\n\t\tif ( isString( value ) ) {\n\t\t\tvalue = string2buffer( value );\n\t\t} else if ( isBuffer( value ) ) { // NOTE: order matters here. We want the `isBuffer` check BEFORE the `isUint8Array` check!!\n\t\t\t// Nothing to do, as value is already a buffer...\n\t\t} else if ( isUint8Array( value ) ) {\n\t\t\t// Convert to a `Buffer` object to provide backward compatibility with older Node.js versions...\n\t\t\tvalue = arraybuffer2buffer( value.buffer, value.byteOffset, value.length ); // eslint-disable-line max-len\n\t\t} else {\n\t\t\tthrow new TypeError( format( 'invalid argument. In binary mode, a provided value must be a string, Buffer, or Uint8Array. Value: `%s`.', value ) );\n\t\t}\n\t}\n\t// Make the stream a readable stream:\n\tdebug( 'Creating a readable stream configured with the following options: %s.', JSON.stringify( opts ) );\n\tReadable.call( this, opts );\n\n\t// Destruction state:\n\tsetNonEnumerable( this, '_destroyed', false );\n\n\t// Cache whether the stream is operating in object mode:\n\tsetNonEnumerableReadOnly( this, '_objectMode', opts.objectMode );\n\n\t// Cache the separator:\n\tsetNonEnumerableReadOnly( this, '_sep', string2buffer( opts.sep ) );\n\n\t// Cache the total number of iterations:\n\tsetNonEnumerableReadOnly( this, '_iter', opts.iter );\n\n\t// Cache the value to stream:\n\tsetNonEnumerableReadOnly( this, '_value', value );\n\n\t// Initialize an iteration counter:\n\tsetNonEnumerable( this, '_i', 0 );\n\n\treturn this;\n}\n\n/*\n* Inherit from the `Readable` prototype.\n*/\ninherit( ConstantStream, Readable );\n\n/**\n* Implements the `_read` method.\n*\n* @private\n* @name _read\n* @memberof ConstantStream.prototype\n* @type {Function}\n* @param {number} size - number (of bytes) to read\n* @returns {void}\n*/\nsetNonEnumerableReadOnly( ConstantStream.prototype, '_read', read );\n\n/**\n* Gracefully destroys a stream, providing backward compatibility.\n*\n* @name destroy\n* @memberof ConstantStream.prototype\n* @type {Function}\n* @param {(string|Object|Error)} [error] - error\n* @returns {ConstantStream} Stream instance\n*/\nsetNonEnumerableReadOnly( ConstantStream.prototype, 'destroy', destroy );\n\n\n// EXPORTS //\n\nexport default ConstantStream;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isNonNegative } from '@stdlib/assert-is-nonnegative-number';\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert-is-nonnegative-integer';\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.sep] - separator used to join streamed data\n* @param {boolean} [options.objectMode] - specifies whether a stream should operate in object mode\n* @param {(string|null)} [options.encoding] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the maximum number of bytes to store in the internal buffer before pausing streaming\n* @param {NonNegativeInteger} [options.iter] - number of iterations\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'objectMode': true\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, 'sep' ) ) {\n\t\topts.sep = options.sep;\n\t\tif ( !isString( opts.sep ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'sep', opts.sep ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'objectMode' ) ) {\n\t\topts.objectMode = options.objectMode;\n\t\tif ( !isBoolean( opts.objectMode ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'objectMode', opts.objectMode ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'encoding' ) ) {\n\t\topts.encoding = options.encoding;\n\t\tif ( !isString( opts.encoding ) && opts.encoding !== null ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a string or null. Option: `%s`.', 'encoding', opts.encoding ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'highWaterMark' ) ) {\n\t\topts.highWaterMark = options.highWaterMark;\n\t\tif ( !isNonNegative( opts.highWaterMark ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a nonnegative number. Option: `%s`.', 'highWaterMark', opts.highWaterMark ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'iter' ) ) {\n\t\topts.iter = options.iter;\n\t\tif ( !isNonNegativeInteger( opts.iter ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a nonnegative integer. Option: `%s`.', 'iter', opts.iter ) );\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/**\n* Create a readable stream which always streams the same value.\n*\n* @module @stdlib/streams-node-from-constant\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n* import constantStream from '@stdlib/streams-node-from-constant';\n*\n* function log( chunk ) {\n* console.log( chunk.toString() );\n* }\n*\n* var opts = {\n* 'iter': 10\n* };\n*\n* var stream = constantStream( 'beep', opts );\n*\n* stream.pipe( inspectStream( log ) );\n*\n* @example\n* import constantStream from '@stdlib/streams-node-from-constant';\n*\n* var opts = {\n* 'sep': ',',\n* 'objectMode': false,\n* 'encoding': 'utf8',\n* 'highWaterMark': 64\n* };\n*\n* var createStream = constantStream.factory( opts );\n*\n* // Create 10 identically configured streams...\n* var streams = [];\n* var i;\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( createStream( i.toString() ) );\n* }\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n* import constantStream from '@stdlib/streams-node-from-constant';\n*\n* function log( v ) {\n* console.log( v );\n* }\n*\n* var opts = {\n* 'iter': 10\n* };\n*\n* var stream = constantStream.objectMode( 3.14, opts );\n*\n* stream.pipe( inspectStream.objectMode( log ) );\n*/\n\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport objectMode from './object_mode.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'objectMode', objectMode );\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 isObject from '@stdlib/assert-is-plain-object';\nimport format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport ConstantStream from './main.js';\n\n\n// MAIN //\n\n/**\n* Returns an \"objectMode\" readable stream which always streams the same value.\n*\n* @param {*} value - value to stream\n* @param {Options} [options] - stream options\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the maximum number of objects to store in an internal buffer before pausing streaming\n* @param {NonNegativeInteger} [options.iter] - number of iterations\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {ConstantStream} Stream instance\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n*\n* function log( v ) {\n* console.log( v );\n* }\n*\n* var opts = {\n* 'iter': 10\n* };\n*\n* var stream = objectMode( 3.14, opts );\n*\n* stream.pipe( inspectStream.objectMode( log ) );\n*/\nfunction objectMode( value, options ) {\n\tvar opts;\n\tif ( arguments.length > 1 ) {\n\t\topts = options;\n\t\tif ( !isObject( opts ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', opts ) );\n\t\t}\n\t\topts = assign( {}, options );\n\t} else {\n\t\topts = {};\n\t}\n\topts.objectMode = true;\n\treturn new ConstantStream( value, opts );\n}\n\n\n// EXPORTS //\n\nexport default objectMode;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isObject from '@stdlib/assert-is-plain-object';\nimport format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport ConstantStream from './main.js';\n\n\n// MAIN //\n\n/**\n* Returns a function for creating readable streams which always stream the same value.\n*\n* @param {(string|Buffer|Uint8Array|*)} [value] - value to stream\n* @param {Options} [options] - stream options\n* @param {boolean} [options.objectMode=false] - specifies whether a stream should operate in object mode\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the maximum number of bytes to store in an internal buffer before pausing streaming\n* @param {string} [options.sep='\\n'] - separator used to join streamed data\n* @param {NonNegativeInteger} [options.iter] - number of iterations\n* @throws {TypeError} options argument must be an object\n* @returns {Function} stream factory\n*\n* @example\n* var opts = {\n* 'sep': ',',\n* 'objectMode': false,\n* 'encoding': 'utf8',\n* 'highWaterMark': 64\n* };\n*\n* var createStream = factory( opts );\n*\n* // Create 10 identically configured streams...\n* var streams = [];\n* var i;\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( createStream( i.toString() ) );\n* }\n*/\nfunction factory( value, options ) {\n\tvar nargs;\n\tvar opts;\n\tvar fcn;\n\tvar FLG;\n\n\tnargs = arguments.length;\n\tif ( nargs === 0 ) {\n\t\topts = {};\n\t\tFLG = true;\n\t} else if ( nargs === 1 ) {\n\t\t// Check (imperfectly!) whether we were provided an \"options\" object...\n\t\tif (\n\t\t\tvalue !== null &&\n\t\t\ttypeof value === 'object' &&\n\t\t\t(\n\t\t\t\thasOwnProp( value, 'sep' ) ||\n\t\t\t\thasOwnProp( value, 'iter' ) ||\n\t\t\t\thasOwnProp( value, 'objectMode' ) ||\n\t\t\t\thasOwnProp( value, 'encoding' ) ||\n\t\t\t\thasOwnProp( value, 'highWaterMark' )\n\t\t\t)\n\t\t) {\n\t\t\topts = assign( {}, value );\n\t\t\tFLG = true;\n\t\t} else {\n\t\t\topts = {};\n\t\t}\n\t} else { // nargs > 1\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\topts = assign( {}, options );\n\t}\n\tif ( FLG ) {\n\t\tfcn = createStream1;\n\t} else {\n\t\tfcn = createStream2;\n\t}\n\treturn fcn;\n\n\t/**\n\t* Returns a readable stream which always streams the same value.\n\t*\n\t* @private\n\t* @param {(string|Buffer|Uint8Array|*)} value - value to stream\n\t* @throws {TypeError} in binary mode, value to stream must be a string, Buffer, or Uint8Array\n\t* @throws {TypeError} options argument must be an object\n\t* @throws {TypeError} must provide valid options\n\t* @returns {ConstantStream} Stream instance\n\t*/\n\tfunction createStream1( value ) {\n\t\treturn new ConstantStream( value, opts );\n\t}\n\n\t/**\n\t* Returns a readable stream which always streams the same value.\n\t*\n\t* @private\n\t* @throws {TypeError} in binary mode, value to stream must be a string, Buffer, or Uint8Array\n\t* @throws {TypeError} options argument must be an object\n\t* @throws {TypeError} must provide valid options\n\t* @returns {ConstantStream} Stream instance\n\t*/\n\tfunction createStream2() {\n\t\treturn new ConstantStream( value, opts );\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\nvar logger = require( 'debug' );\n\n\n// MAIN //\n\nvar debug = logger( 'from-iterator-stream' );\n\n\n// EXPORTS //\n\nexport default debug;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar Readable = require( 'readable-stream' ).Readable;\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport isIteratorLike from '@stdlib/assert-is-iterator-like';\nimport isError from '@stdlib/assert-is-error';\nimport isBuffer from '@stdlib/assert-is-buffer';\nimport assign from '@stdlib/object-assign';\nimport inherit from '@stdlib/utils-inherit';\nimport setNonEnumerable from '@stdlib/utils-define-nonenumerable-property';\nimport setNonEnumerableReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport string2buffer from '@stdlib/buffer-from-string';\nimport Buffer from '@stdlib/buffer-ctor'; // TODO: replace Buffer.concat usage with stdlib pkg\nimport nextTick from '@stdlib/utils-next-tick';\nimport format from '@stdlib/string-format';\nimport DEFAULTS from './defaults.json';\nimport validate from './validate.js';\nimport debug from './debug.js';\n\n\n// FUNCTIONS //\n\n/**\n* Implements the `_read` method.\n*\n* @private\n* @param {number} size - number (of bytes) to read\n* @returns {void}\n*/\nfunction read() {\n\t/* eslint-disable no-invalid-this */\n\tvar FLG;\n\tvar err;\n\tvar v;\n\n\tif ( this._destroyed ) {\n\t\treturn;\n\t}\n\tFLG = true;\n\twhile ( FLG ) {\n\t\tv = this._iterator.next();\n\t\tthis._i += 1;\n\t\tif ( v.done ) {\n\t\t\tif ( hasOwnProp( v, 'value' ) ) {\n\t\t\t\tv = v.value;\n\t\t\t\tdebug( 'Value: %s. Iter: %d.', JSON.stringify( v ), this._i );\n\t\t\t\tif ( this._objectMode === false ) {\n\t\t\t\t\tv = this._serialize( v );\n\t\t\t\t\tif ( typeof v === 'string' ) {\n\t\t\t\t\t\tif ( this._i === 1 ) { // eslint-disable-line max-depth\n\t\t\t\t\t\t\tv = string2buffer( v );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tv = string2buffer( this._sep+v );\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis.push( v );\n\t\t\t\t\t} else if ( isBuffer( v ) ) {\n\t\t\t\t\t\tif ( this._i > 1 ) { // eslint-disable-line max-depth\n\t\t\t\t\t\t\tv = Buffer.concat( [ string2buffer( this._sep ), v ] ); // eslint-disable-line max-len\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis.push( v );\n\t\t\t\t\t} else {\n\t\t\t\t\t\terr = new Error( format( 'invalid operation. Serialization function must return a string or Buffer. Value: `%s`.', v ) );\n\t\t\t\t\t\tthis.emit( 'error', err );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tdebug( 'Finished iteration.' );\n\t\t\treturn this.push( null );\n\t\t}\n\t\tv = v.value;\n\t\tdebug( 'Value: %s. Iter: %d.', JSON.stringify( v ), this._i );\n\n\t\tif ( this._objectMode === false ) {\n\t\t\tv = this._serialize( v );\n\t\t\tif ( typeof v === 'string' ) {\n\t\t\t\tif ( this._i === 1 ) {\n\t\t\t\t\tv = string2buffer( v );\n\t\t\t\t} else {\n\t\t\t\t\tv = string2buffer( this._sep+v );\n\t\t\t\t}\n\t\t\t} else if ( isBuffer( v ) ) {\n\t\t\t\tif ( this._i > 1 ) {\n\t\t\t\t\tv = Buffer.concat( [ string2buffer( this._sep ), v ] );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\terr = new Error( format( 'invalid operation. Serialization function must return a string or Buffer. Value: `%s`.', v ) );\n\t\t\t\tthis.emit( 'error', err );\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\tFLG = this.push( v );\n\t}\n\n\t/* eslint-enable no-invalid-this */\n}\n\n/**\n* Gracefully destroys a stream, providing backward compatibility.\n*\n* @private\n* @param {(string|Object|Error)} [error] - error\n* @returns {IteratorStream} Stream instance\n*/\nfunction destroy( error ) {\n\t/* eslint-disable no-invalid-this */\n\tvar self;\n\tif ( this._destroyed ) {\n\t\tdebug( 'Attempted to destroy an already destroyed stream.' );\n\t\treturn this;\n\t}\n\tself = this;\n\tthis._destroyed = true;\n\n\tnextTick( close );\n\n\treturn this;\n\n\t/**\n\t* Closes a stream.\n\t*\n\t* @private\n\t*/\n\tfunction close() {\n\t\tif ( error ) {\n\t\t\tdebug( 'Stream was destroyed due to an error. Error: %s.', ( isError( error ) ) ? error.message : JSON.stringify( error ) );\n\t\t\tself.emit( 'error', error );\n\t\t}\n\t\tdebug( 'Closing the stream...' );\n\t\tself.emit( 'close' );\n\t}\n\n\t/* eslint-enable no-invalid-this */\n}\n\n\n// MAIN //\n\n/**\n* Stream constructor for generating a readable stream from an iterator.\n*\n* @constructor\n* @param {Iterator} iterator - source iterator\n* @param {Options} [options] - stream options\n* @param {boolean} [options.objectMode=false] - specifies whether the stream should operate in object mode\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to strings\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the maximum number of bytes to store in an internal buffer before pausing iteration\n* @param {string} [options.sep='\\n'] - separator used to join streamed data\n* @param {Function} [options.serialize] - custom serialization function\n* @throws {TypeError} first argument must be an iterator\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {IteratorStream} Stream instance\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n* import randu from '@stdlib/random-iter-randu';\n*\n* function log( chunk ) {\n* console.log( chunk.toString() );\n* }\n*\n* var opts = {\n* 'iter': 10\n* };\n*\n* var stream = new IteratorStream( randu( opts ) );\n*\n* stream.pipe( inspectStream( log ) );\n*/\nfunction IteratorStream( iterator, options ) {\n\tvar opts;\n\tvar err;\n\tif ( !( this instanceof IteratorStream ) ) {\n\t\tif ( arguments.length > 1 ) {\n\t\t\treturn new IteratorStream( iterator, options );\n\t\t}\n\t\treturn new IteratorStream( iterator );\n\t}\n\tif ( !isIteratorLike( iterator ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an iterator. Value: `%s`.', iterator ) );\n\t}\n\topts = assign( {}, DEFAULTS );\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\t// Make the stream a readable stream:\n\tdebug( 'Creating a readable stream configured with the following options: %s.', JSON.stringify( opts ) );\n\tReadable.call( this, opts );\n\n\t// Destruction state:\n\tsetNonEnumerable( this, '_destroyed', false );\n\n\t// Cache whether the stream is operating in object mode:\n\tsetNonEnumerableReadOnly( this, '_objectMode', opts.objectMode );\n\n\t// Cache the separator:\n\tsetNonEnumerableReadOnly( this, '_sep', opts.sep );\n\n\t// Define the serialization function:\n\tsetNonEnumerableReadOnly( this, '_serialize', opts.serialize || JSON.stringify );\n\n\t// Cache the iterator:\n\tsetNonEnumerableReadOnly( this, '_iterator', iterator );\n\n\t// Initialize an iteration counter:\n\tsetNonEnumerable( this, '_i', 0 );\n\n\treturn this;\n}\n\n/*\n* Inherit from the `Readable` prototype.\n*/\ninherit( IteratorStream, Readable );\n\n/**\n* Implements the `_read` method.\n*\n* @private\n* @name _read\n* @memberof IteratorStream.prototype\n* @type {Function}\n* @param {number} size - number (of bytes) to read\n* @returns {void}\n*/\nsetNonEnumerableReadOnly( IteratorStream.prototype, '_read', read );\n\n/**\n* Gracefully destroys a stream, providing backward compatibility.\n*\n* @name destroy\n* @memberof IteratorStream.prototype\n* @type {Function}\n* @param {(string|Object|Error)} [error] - error\n* @returns {IteratorStream} Stream instance\n*/\nsetNonEnumerableReadOnly( IteratorStream.prototype, 'destroy', destroy );\n\n\n// EXPORTS //\n\nexport default IteratorStream;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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';\n\n\n// MAIN //\n\n/**\n* Tests if a value is iterator-like.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is iterator-like\n*\n* @example\n* var it = {\n* 'next': function noop() {}\n* };\n* var bool = isIteratorLike( it );\n* // returns true\n*\n* @example\n* var bool = isIteratorLike( {} );\n* // returns false\n*\n* @example\n* var bool = isIteratorLike( null );\n* // returns false\n*/\nfunction isIteratorLike( value ) {\n\tvar t = typeof value;\n\treturn (\n\t\tvalue !== null &&\n\t\t( t === 'object' || t === 'function' ) &&\n\t\tisFunction( value.next )\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isIteratorLike;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isNonNegative } from '@stdlib/assert-is-nonnegative-number';\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport isFunction from '@stdlib/assert-is-function';\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.sep] - separator used to join streamed data\n* @param {boolean} [options.objectMode] - specifies whether a stream should operate in object mode\n* @param {(string|null)} [options.encoding] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the maximum number of bytes to store in the internal buffer before pausing iteration\n* @param {Function} [options.serialize] - custom serialization function\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'objectMode': true\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, 'sep' ) ) {\n\t\topts.sep = options.sep;\n\t\tif ( !isString( opts.sep ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'sep', opts.sep ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'objectMode' ) ) {\n\t\topts.objectMode = options.objectMode;\n\t\tif ( !isBoolean( opts.objectMode ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'objectMode', opts.objectMode ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'encoding' ) ) {\n\t\topts.encoding = options.encoding;\n\t\tif ( !isString( opts.encoding ) && opts.encoding !== null ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a string or null. Option: `%s`.', 'encoding', opts.encoding ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'highWaterMark' ) ) {\n\t\topts.highWaterMark = options.highWaterMark;\n\t\tif ( !isNonNegative( opts.highWaterMark ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a nonnegative number. Option: `%s`.', 'highWaterMark', opts.highWaterMark ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'serialize' ) ) {\n\t\topts.serialize = options.serialize;\n\t\tif ( !isFunction( opts.serialize ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a function. Option: `%s`.', 'serialize', opts.serialize ) );\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/**\n* Create a readable stream from an iterator.\n*\n* @module @stdlib/streams-node-from-iterator\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n* import randu from '@stdlib/random-iter-randu';\n* import iteratorStream from '@stdlib/streams-node-from-iterator';\n*\n* function log( chunk ) {\n* console.log( chunk.toString() );\n* }\n*\n* var opts = {\n* 'iter': 10\n* };\n*\n* var stream = iteratorStream( randu( opts ) );\n*\n* stream.pipe( inspectStream( log ) );\n*\n* @example\n* import randu from '@stdlib/random-iter-randu';\n* import iteratorStream from '@stdlib/streams-node-from-iterator';\n*\n* var opts = {\n* 'sep': ',',\n* 'objectMode': false,\n* 'encoding': 'utf8',\n* 'highWaterMark': 64\n* };\n*\n* var createStream = iteratorStream.factory( opts );\n*\n* // Create 10 identically configured streams...\n* var streams = [];\n* var i;\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( createStream( randu() ) );\n* }\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n* import randu from '@stdlib/random-iter-randu';\n* import iteratorStream from '@stdlib/streams-node-from-iterator';\n*\n* function log( v ) {\n* console.log( v );\n* }\n*\n* var opts = {\n* 'iter': 10\n* };\n*\n* var stream = iteratorStream.objectMode( randu( opts ) );\n*\n* stream.pipe( inspectStream.objectMode( log ) );\n*/\n\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport objectMode from './object_mode.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'objectMode', objectMode );\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 isObject from '@stdlib/assert-is-plain-object';\nimport format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport IteratorStream from './main.js';\n\n\n// MAIN //\n\n/**\n* Returns an \"objectMode\" readable stream from an iterator.\n*\n* @param {Iterator} iterator - source iterator\n* @param {Options} [options] - stream options\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the maximum number of objects to store in an internal buffer before pausing iteration\n* @throws {TypeError} first argument must be an iterator\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {IteratorStream} Stream instance\n*\n* @example\n* import randu from '@stdlib/random-iter-randu';\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n*\n* function log( v ) {\n* console.log( v );\n* }\n*\n* var opts = {\n* 'iter': 10\n* };\n*\n* var stream = objectMode( randu( opts ) );\n*\n* stream.pipe( inspectStream.objectMode( log ) );\n*/\nfunction objectMode( iterator, options ) {\n\tvar opts;\n\tif ( arguments.length > 1 ) {\n\t\topts = options;\n\t\tif ( !isObject( opts ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', opts ) );\n\t\t}\n\t\topts = assign( {}, options );\n\t} else {\n\t\topts = {};\n\t}\n\topts.objectMode = true;\n\treturn new IteratorStream( iterator, opts );\n}\n\n\n// EXPORTS //\n\nexport default objectMode;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport IteratorStream from './main.js';\n\n\n// MAIN //\n\n/**\n* Returns a function for creating readable streams from iterators.\n*\n* @param {Options} [options] - stream options\n* @param {boolean} [options.objectMode=false] - specifies whether a stream should operate in object mode\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the maximum number of bytes to store in an internal buffer before pausing iteration\n* @param {string} [options.sep='\\n'] - separator used to join streamed data\n* @param {Function} [options.serialize] - custom serialization function\n* @throws {TypeError} options argument must be an object\n* @returns {Function} stream factory\n*\n* @example\n* import randu from '@stdlib/random-iter-randu';\n*\n* var opts = {\n* 'sep': ',',\n* 'objectMode': false,\n* 'encoding': 'utf8',\n* 'highWaterMark': 64\n* };\n*\n* var createStream = factory( opts );\n*\n* // Create 10 identically configured streams...\n* var streams = [];\n* var i;\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( createStream( randu() ) );\n* }\n*/\nfunction factory( options ) {\n\tvar opts;\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\topts = assign( {}, options );\n\t} else {\n\t\topts = {};\n\t}\n\treturn createStream;\n\n\t/**\n\t* Returns a readable stream from an iterator.\n\t*\n\t* @private\n\t* @param {Iterator} iterator - source iterator\n\t* @throws {TypeError} must provide an iterator\n\t* @throws {TypeError} options argument must be an object\n\t* @throws {TypeError} must provide valid options\n\t* @returns {IteratorStream} Stream instance\n\t*/\n\tfunction createStream( iterator ) {\n\t\treturn new IteratorStream( iterator, opts );\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\nvar logger = require( 'debug' );\n\n\n// MAIN //\n\nvar debug = logger( 'from-strided-array-stream' );\n\n\n// EXPORTS //\n\nexport default debug;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar Readable = require( 'readable-stream' ).Readable;\nimport isCollection from '@stdlib/assert-is-collection';\nimport isError from '@stdlib/assert-is-error';\nimport isBuffer from '@stdlib/assert-is-buffer';\nimport { isPrimitive as isInteger } from '@stdlib/assert-is-integer';\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert-is-nonnegative-integer';\nimport assign from '@stdlib/object-assign';\nimport inherit from '@stdlib/utils-inherit';\nimport setNonEnumerable from '@stdlib/utils-define-nonenumerable-property';\nimport setNonEnumerableReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport string2buffer from '@stdlib/buffer-from-string';\nimport Buffer from '@stdlib/buffer-ctor'; // TODO: replace Buffer.concat usage with stdlib pkg\nimport format from '@stdlib/string-format';\nimport nextTick from '@stdlib/utils-next-tick';\nimport DEFAULTS from './defaults.json';\nimport validate from './validate.js';\nimport debug from './debug.js';\n\n\n// FUNCTIONS //\n\n/**\n* Implements the `_read` method.\n*\n* @private\n* @param {number} size - number (of bytes) to read\n* @returns {void}\n*/\nfunction read() {\n\t/* eslint-disable no-invalid-this */\n\tvar FLG;\n\tvar err;\n\tvar v;\n\n\tif ( this._destroyed ) {\n\t\treturn;\n\t}\n\tFLG = true;\n\twhile ( FLG ) {\n\t\terr = null;\n\n\t\tthis._i += 1;\n\t\tif ( this._i > this._N ) {\n\t\t\tdebug( 'Finished iteration.' );\n\t\t\treturn this.push( null );\n\t\t}\n\t\tv = this._buffer[ this._idx ];\n\t\tdebug( 'Value: %s. Idx: %d. Iter: %d.', JSON.stringify( v ), this._idx, this._i );\n\n\t\tthis._idx += this._stride;\n\t\tif ( this._objectMode === false ) {\n\t\t\tv = this._serialize( v );\n\t\t\tif ( typeof v === 'string' ) {\n\t\t\t\tif ( this._i === 1 ) {\n\t\t\t\t\tv = string2buffer( v );\n\t\t\t\t} else {\n\t\t\t\t\tv = string2buffer( this._sep+v );\n\t\t\t\t}\n\t\t\t} else if ( isBuffer( v ) ) {\n\t\t\t\tif ( this._i > 1 ) {\n\t\t\t\t\tv = Buffer.concat( [ string2buffer( this._sep ), v ] );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\terr = new Error( format( 'invalid operation. Serialization function must return a string or Buffer. Value: `%s`.', v ) );\n\t\t\t}\n\t\t}\n\t\tif ( err ) {\n\t\t\tthis.emit( 'error', err );\n\t\t} else {\n\t\t\tFLG = this.push( v );\n\t\t}\n\t}\n\n\t/* eslint-enable no-invalid-this */\n}\n\n/**\n* Gracefully destroys a stream, providing backward compatibility.\n*\n* @private\n* @param {(string|Object|Error)} [error] - error\n* @returns {StridedArrayStream} Stream instance\n*/\nfunction destroy( error ) {\n\t/* eslint-disable no-invalid-this */\n\tvar self;\n\tif ( this._destroyed ) {\n\t\tdebug( 'Attempted to destroy an already destroyed stream.' );\n\t\treturn this;\n\t}\n\tself = this;\n\tthis._destroyed = true;\n\n\tnextTick( close );\n\n\treturn this;\n\n\t/**\n\t* Closes a stream.\n\t*\n\t* @private\n\t*/\n\tfunction close() {\n\t\tif ( error ) {\n\t\t\tdebug( 'Stream was destroyed due to an error. Error: %s.', ( isError( error ) ) ? error.message : JSON.stringify( error ) );\n\t\t\tself.emit( 'error', error );\n\t\t}\n\t\tdebug( 'Closing the stream...' );\n\t\tself.emit( 'close' );\n\t}\n\n\t/* eslint-enable no-invalid-this */\n}\n\n\n// MAIN //\n\n/**\n* Stream constructor for generating a readable stream from an array-like object.\n*\n* @constructor\n* @param {NonNegativeInteger} N - number of values to stream\n* @param {Collection} buffer - source value\n* @param {integer} stride - stride length\n* @param {NonNegativeInteger} offset - starting index\n* @param {Options} [options] - stream options\n* @param {boolean} [options.objectMode=false] - specifies whether the stream should operate in object mode\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to strings\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the maximum number of bytes to store in an internal buffer before pausing streaming\n* @param {string} [options.sep='\\n'] - separator used to join streamed data\n* @param {Function} [options.serialize] - custom serialization function\n* @throws {TypeError} first argument must be a nonnegative integer\n* @throws {TypeError} second argument must be an array-like object\n* @throws {TypeError} third argument must be an integer\n* @throws {TypeError} fourth argument must be a nonnegative integer\n* @throws {RangeError} linear index cannot exceed array bounds\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {StridedArrayStream} Stream instance\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n* import Float64Array from '@stdlib/array-float64';\n* import randu from '@stdlib/random-base-randu';\n*\n* function log( chunk ) {\n* console.log( chunk.toString() );\n* }\n*\n* var arr = new Float64Array( 10 );\n* var i;\n* for ( i = 0; i < arr.length; i++ ) {\n* arr[ i ] = randu();\n* }\n*\n* var stream = new StridedArrayStream( arr.length, arr, 1, 0 );\n*\n* stream.pipe( inspectStream( log ) );\n*/\nfunction StridedArrayStream( N, buffer, stride, offset, options ) {\n\tvar opts;\n\tvar err;\n\tvar i;\n\tif ( !( this instanceof StridedArrayStream ) ) {\n\t\tif ( arguments.length > 4 ) {\n\t\t\treturn new StridedArrayStream( N, buffer, stride, offset, options );\n\t\t}\n\t\treturn new StridedArrayStream( N, buffer, stride, offset );\n\t}\n\tif ( !isNonNegativeInteger( N ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a nonnegative integer. Value: `%s`.', N ) );\n\t}\n\tif ( !isCollection( buffer ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be an array-like object. Value: `%s`.', buffer ) );\n\t}\n\tif ( !isInteger( stride ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Third argument must be an integer. Value: `%s`.', stride ) );\n\t}\n\tif ( !isNonNegativeInteger( offset ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Fourth argument must be a nonnegative integer. Value: `%s`.', offset ) );\n\t}\n\tif ( N > 0 ) {\n\t\ti = offset + ((N-1)*stride);\n\t\tif ( offset >= buffer.length || i < 0 || i >= buffer.length ) {\n\t\t\tthrow new RangeError( 'invalid arguments. Strided array parameters are incompatible with the provided array-like object. Linear index exceeds array bounds.' );\n\t\t}\n\t}\n\topts = assign( {}, DEFAULTS );\n\tif ( arguments.length > 4 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t}\n\t// Make the stream a readable stream:\n\tdebug( 'Creating a readable stream configured with the following options: %s.', JSON.stringify( opts ) );\n\tReadable.call( this, opts );\n\n\t// Destruction state:\n\tsetNonEnumerable( this, '_destroyed', false );\n\n\t// Cache whether the stream is operating in object mode:\n\tsetNonEnumerableReadOnly( this, '_objectMode', opts.objectMode );\n\n\t// Cache the separator:\n\tsetNonEnumerableReadOnly( this, '_sep', opts.sep );\n\n\t// Define the serialization function:\n\tsetNonEnumerableReadOnly( this, '_serialize', opts.serialize || JSON.stringify );\n\n\t// Cache the data source:\n\tsetNonEnumerableReadOnly( this, '_buffer', buffer );\n\n\t// Cache the strided array parameters:\n\tsetNonEnumerableReadOnly( this, '_N', N );\n\tsetNonEnumerableReadOnly( this, '_stride', stride );\n\tsetNonEnumerableReadOnly( this, '_offset', offset );\n\tsetNonEnumerable( this, '_idx', offset );\n\n\t// Initialize an iteration counter:\n\tsetNonEnumerable( this, '_i', 0 );\n\n\treturn this;\n}\n\n/*\n* Inherit from the `Readable` prototype.\n*/\ninherit( StridedArrayStream, Readable );\n\n/**\n* Implements the `_read` method.\n*\n* @private\n* @name _read\n* @memberof StridedArrayStream.prototype\n* @type {Function}\n* @param {number} size - number (of bytes) to read\n* @returns {void}\n*/\nsetNonEnumerableReadOnly( StridedArrayStream.prototype, '_read', read );\n\n/**\n* Gracefully destroys a stream, providing backward compatibility.\n*\n* @name destroy\n* @memberof StridedArrayStream.prototype\n* @type {Function}\n* @param {(string|Object|Error)} [error] - error\n* @returns {StridedArrayStream} Stream instance\n*/\nsetNonEnumerableReadOnly( StridedArrayStream.prototype, 'destroy', destroy );\n\n\n// EXPORTS //\n\nexport default StridedArrayStream;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isNonNegative } from '@stdlib/assert-is-nonnegative-number';\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport isFunction from '@stdlib/assert-is-function';\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.sep] - separator used to join streamed data\n* @param {boolean} [options.objectMode] - specifies whether a stream should operate in object mode\n* @param {(string|null)} [options.encoding] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the maximum number of bytes to store in the internal buffer before pausing streaming\n* @param {Function} [options.serialize] - custom serialization function\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'objectMode': true\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, 'sep' ) ) {\n\t\topts.sep = options.sep;\n\t\tif ( !isString( opts.sep ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'sep', opts.sep ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'objectMode' ) ) {\n\t\topts.objectMode = options.objectMode;\n\t\tif ( !isBoolean( opts.objectMode ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'objectMode', opts.objectMode ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'encoding' ) ) {\n\t\topts.encoding = options.encoding;\n\t\tif ( !isString( opts.encoding ) && opts.encoding !== null ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a string or null. Option: `%s`.', 'encoding', opts.encoding ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'highWaterMark' ) ) {\n\t\topts.highWaterMark = options.highWaterMark;\n\t\tif ( !isNonNegative( opts.highWaterMark ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a nonnegative number. Option: `%s`.', 'highWaterMark', opts.highWaterMark ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'serialize' ) ) {\n\t\topts.serialize = options.serialize;\n\t\tif ( !isFunction( opts.serialize ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a function. Option: `%s`.', 'serialize', opts.serialize ) );\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/**\n* Create a readable stream from a strided array-like value.\n*\n* @module @stdlib/streams-node-from-strided-array\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n* import Float64Array from '@stdlib/array-float64';\n* import randu from '@stdlib/random-base-randu';\n* import stridedArrayStream from '@stdlib/streams-node-from-strided-array';\n*\n* function log( chunk ) {\n* console.log( chunk.toString() );\n* }\n*\n* var arr = new Float64Array( 10 );\n* var i;\n* for ( i = 0; i < arr.length; i++ ) {\n* arr[ i ] = randu();\n* }\n*\n* var stream = stridedArrayStream( arr.length, arr, 1, 0 );\n*\n* stream.pipe( inspectStream( log ) );\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n* import randu from '@stdlib/random-base-randu';\n* import stridedArrayStream from '@stdlib/streams-node-from-strided-array';\n*\n* var arr = new Float64Array( 10 );\n* var i;\n* for ( i = 0; i < arr.length; i++ ) {\n* arr[ i ] = randu();\n* }\n*\n* var opts = {\n* 'sep': ',',\n* 'objectMode': false,\n* 'encoding': 'utf8',\n* 'highWaterMark': 64\n* };\n*\n* var createStream = stridedArrayStream.factory( opts );\n*\n* // Create 10 identically configured streams...\n* var streams = [];\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( createStream( arr.length, arr, 1, 0 ) );\n* }\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n* import Float64Array from '@stdlib/array-float64';\n* import randu from '@stdlib/random-base-randu';\n* import stridedArrayStream from '@stdlib/streams-node-from-strided-array';\n*\n* function log( v ) {\n* console.log( v );\n* }\n*\n* var arr = new Float64Array( 10 );\n* var i;\n* for ( i = 0; i < arr.length; i++ ) {\n* arr[ i ] = randu();\n* }\n*\n* var stream = stridedArrayStream.objectMode( arr.length, arr, 1, 0 );\n*\n* stream.pipe( inspectStream.objectMode( log ) );\n*/\n\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport objectMode from './object_mode.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'objectMode', objectMode );\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 isObject from '@stdlib/assert-is-plain-object';\nimport format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport StridedArrayStream from './main.js';\n\n\n// MAIN //\n\n/**\n* Returns an \"objectMode\" readable stream from an array-like value.\n*\n* @param {NonNegativeInteger} N - number of values to stream\n* @param {Collection} buffer - source value\n* @param {integer} stride - stride length\n* @param {NonNegativeInteger} offset - starting index\n* @param {Options} [options] - stream options\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the maximum number of objects to store in an internal buffer before pausing streaming\n* @throws {TypeError} first argument must be a nonnegative integer\n* @throws {TypeError} second argument must be an array-like object\n* @throws {TypeError} third argument must be an integer\n* @throws {TypeError} fourth argument must be a nonnegative integer\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {StridedArrayStream} Stream instance\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n* import Float64Array from '@stdlib/array-float64';\n* import randu from '@stdlib/random-base-randu';\n*\n* function log( v ) {\n* console.log( v );\n* }\n*\n* var arr = new Float64Array( 10 );\n* var i;\n* for ( i = 0; i < arr.length; i++ ) {\n* arr[ i ] = randu();\n* }\n*\n* var stream = objectMode( arr.length, arr, 1, 0 );\n*\n* stream.pipe( inspectStream.objectMode( log ) );\n*/\nfunction objectMode( N, buffer, stride, offset, options ) {\n\tvar opts;\n\tif ( arguments.length > 4 ) {\n\t\topts = options;\n\t\tif ( !isObject( opts ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', opts ) );\n\t\t}\n\t\topts = assign( {}, options );\n\t} else {\n\t\topts = {};\n\t}\n\topts.objectMode = true;\n\treturn new StridedArrayStream( N, buffer, stride, offset, opts );\n}\n\n\n// EXPORTS //\n\nexport default objectMode;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport StridedArrayStream from './main.js';\n\n\n// MAIN //\n\n/**\n* Returns a function for creating readable streams from strided array-like values.\n*\n* @param {Options} [options] - stream options\n* @param {boolean} [options.objectMode=false] - specifies whether a stream should operate in object mode\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the maximum number of bytes to store in an internal buffer before pausing streaming\n* @param {string} [options.sep='\\n'] - separator used to join streamed data\n* @param {Function} [options.serialize] - custom serialization function\n* @throws {TypeError} options argument must be an object\n* @returns {Function} stream factory\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n* import randu from '@stdlib/random-base-randu';\n*\n* var arr = new Float64Array( 10 );\n* var i;\n* for ( i = 0; i < arr.length; i++ ) {\n* arr[ i ] = randu();\n* }\n*\n* var opts = {\n* 'sep': ',',\n* 'objectMode': false,\n* 'encoding': 'utf8',\n* 'highWaterMark': 64\n* };\n*\n* var createStream = factory( opts );\n*\n* // Create 10 identically configured streams...\n* var streams = [];\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( createStream( arr.length, arr, 1, 0 ) );\n* }\n*/\nfunction factory( options ) {\n\tvar opts;\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\topts = assign( {}, options );\n\t} else {\n\t\topts = {};\n\t}\n\treturn createStream;\n\n\t/**\n\t* Returns a readable stream from an array-like object.\n\t*\n\t* @private\n\t* @param {NonNegativeInteger} N - number of values to stream\n\t* @param {Collection} buffer - source array-like object\n\t* @param {integer} stride - stride length\n\t* @param {NonNegativeInteger} offset - starting index\n\t* @throws {TypeError} must provide an array-like object\n\t* @throws {TypeError} options argument must be an object\n\t* @throws {TypeError} must provide valid options\n\t* @returns {StridedArrayStream} Stream instance\n\t*/\n\tfunction createStream( N, buffer, stride, offset ) {\n\t\treturn new StridedArrayStream( N, buffer, stride, offset, opts );\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\nvar logger = require( 'debug' );\n\n\n// MAIN //\n\nvar debug = logger( 'join-stream' );\n\n\n// EXPORTS //\n\nexport default debug;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar Transform = require( 'readable-stream' ).Transform;\nimport string2buffer from '@stdlib/buffer-from-string';\nimport inherit from '@stdlib/utils-inherit';\nimport Buffer from '@stdlib/buffer-ctor';\nimport setNonEnumerable from '@stdlib/utils-define-nonenumerable-property';\nimport setNonEnumerableReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport nextTick from '@stdlib/utils-next-tick';\nimport defaults from './defaults.js';\nimport validate from './validate.js';\nimport debug from './debug.js';\n\n\n// FUNCTIONS //\n\n/**\n* Implements the `_transform` method.\n*\n* @private\n* @param {(Uint8Array|Buffer|string)} chunk - streamed chunk\n* @param {string} encoding - Buffer encoding\n* @param {Callback} clbk - callback to invoke after transforming the streamed chunk\n*/\nfunction transform( chunk, encoding, clbk ) {\n\t/* eslint-disable no-invalid-this */\n\tvar len;\n\n\tthis._idx += 1;\n\tdebug( 'Received a new chunk. Chunk: %s. Encoding: %s. Index: %d.', chunk.toString(), encoding, this._idx );\n\tif ( this._encoding === 'utf8' ) {\n\t\tif ( this._init ) {\n\t\t\tchunk = this._sep + chunk;\n\t\t} else {\n\t\t\tthis._init = true;\n\t\t}\n\t} else if ( this._init ) {\n\t\tchunk = new Buffer( chunk, encoding );\n\t\tlen = this._sep.length + chunk.length;\n\t\tchunk = Buffer.concat( [ this._sep, chunk ], len ); // TODO: replace with stdlib pkg\n\t\tchunk = chunk.toString( this._encoding );\n\t} else {\n\t\tthis._init = true;\n\t}\n\tthis.push( chunk, this._encoding );\n\tclbk();\n\n\t/* eslint-enable no-invalid-this */\n}\n\n/**\n* Implements the `_flush` method.\n*\n* @private\n* @param {Callback} clbk - callback to invoke after performing flush tasks\n*/\nfunction flush( clbk ) {\n\tdebug( 'Flushing the stream...' );\n\tclbk(); // TODO: consider supporting an option to append a final separator\n}\n\n/**\n* Gracefully destroys a stream, providing backward compatibility.\n*\n* @private\n* @param {Object} [error] - optional error message\n* @returns {JoinStream} Stream instance\n*/\nfunction destroy( error ) {\n\t/* eslint-disable no-invalid-this */\n\tvar self;\n\tif ( this._destroyed ) {\n\t\tdebug( 'Attempted to destroy an already destroyed stream.' );\n\t\treturn this;\n\t}\n\tself = this;\n\tthis._destroyed = true;\n\n\tnextTick( close );\n\n\treturn this;\n\n\t/**\n\t* Closes a stream.\n\t*\n\t* @private\n\t*/\n\tfunction close() {\n\t\tif ( error ) {\n\t\t\tdebug( 'Stream was destroyed due to an error. Error: %s.', JSON.stringify( error ) );\n\t\t\tself.emit( 'error', error );\n\t\t}\n\t\tdebug( 'Closing the stream...' );\n\t\tself.emit( 'close' );\n\t}\n\n\t/* eslint-enable no-invalid-this */\n}\n\n\n// MAIN //\n\n/**\n* Join stream constructor.\n*\n* @constructor\n* @param {Options} [options] - stream options\n* @param {string} [options.sep='\\n'] - separator used to join streamed data\n* @param {boolean} [options.objectMode=false] - specifies whether the stream should operate in object mode\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.allowHalfOpen=false] - specifies whether the stream should remain open even if one side ends\n* @param {boolean} [options.readableObjectMode=false] - specifies whether the readable side should be in object mode\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {JoinStream} join stream\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n*\n* function log( chunk ) {\n* console.log( chunk );\n* }\n*\n* var stream = new JoinStream();\n*\n* stream.pipe( inspectStream( log ) );\n*\n* stream.write( '1' );\n* stream.write( '2' );\n* stream.write( '3' );\n*\n* stream.end();\n*\n* // prints: '1\\n2\\n3'\n*/\nfunction JoinStream( options ) {\n\tvar opts;\n\tvar err;\n\tif ( !( this instanceof JoinStream ) ) {\n\t\tif ( arguments.length ) {\n\t\t\treturn new JoinStream( options );\n\t\t}\n\t\treturn new JoinStream();\n\t}\n\topts = defaults();\n\tif ( arguments.length ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t}\n\t// The stream's writable state should always be in object mode to prevent incoming data from being buffered (concatenated) and thus lose separation...\n\topts.writableObjectMode = true;\n\n\t// The stream converts each chunk into a string so no need to encode strings written to the join stream as Buffer objects:\n\topts.decodeStrings = false;\n\n\t// Make the stream a Transform stream:\n\tdebug( 'Creating a transform stream configured with the following options: %s.', JSON.stringify( opts ) );\n\tTransform.call( this, opts );\n\n\t// Destruction state:\n\tsetNonEnumerable( this, '_destroyed', false );\n\n\t// Cache the encoding:\n\tsetNonEnumerableReadOnly( this, '_encoding', ( opts.encoding === null ) ? 'utf8' : opts.encoding );\n\n\t// Cache the separator:\n\tif ( this._encoding !== 'utf8' ) {\n\t\topts.sep = string2buffer( opts.sep, this._encoding );\n\t}\n\tsetNonEnumerableReadOnly( this, '_sep', opts.sep );\n\n\t// Flag indicating if the stream has received streamed data:\n\tsetNonEnumerable( this, '_init', false );\n\n\t// Chunk counter:\n\tsetNonEnumerable( this, '_idx', -1 );\n\n\treturn this;\n}\n\n/*\n* Inherit from the `Transform` prototype.\n*/\ninherit( JoinStream, Transform );\n\n/**\n* Implements the `_transform` method.\n*\n* @private\n* @name _transform\n* @memberof JoinStream.prototype\n* @type {Function}\n* @param {(Buffer|string)} chunk - streamed chunk\n* @param {string} encoding - Buffer encoding\n* @param {Callback} clbk - callback to invoke after transforming the streamed chunk\n*/\nsetNonEnumerableReadOnly( JoinStream.prototype, '_transform', transform );\n\n/**\n* Implements the `_flush` method.\n*\n* @private\n* @name _flush\n* @memberof JoinStream.prototype\n* @type {Function}\n* @param {Callback} clbk - callback to invoke after performing flush tasks\n*/\nsetNonEnumerableReadOnly( JoinStream.prototype, '_flush', flush );\n\n/**\n* Gracefully destroys a stream, providing backward compatibility.\n*\n* @name destroy\n* @memberof JoinStream.prototype\n* @type {Function}\n* @param {Object} [error] - optional error message\n* @returns {JoinStream} Stream instance\n*/\nsetNonEnumerableReadOnly( JoinStream.prototype, 'destroy', destroy );\n\n\n// EXPORTS //\n\nexport default JoinStream;\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 default options.\n*\n* @private\n* @returns {Object} default options\n*\n* @example\n* var o = defaults();\n* // returns {...}\n*/\nfunction defaults() {\n\treturn {\n\t\t'objectMode': false,\n\t\t'encoding': null,\n\t\t'allowHalfOpen': false,\n\t\t'readableObjectMode': false,\n\t\t'sep': '\\n'\n\t};\n}\n\n\n// EXPORTS //\n\nexport default defaults;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isNonNegative } from '@stdlib/assert-is-nonnegative-number';\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.sep] - separator used to join streamed data\n* @param {boolean} [options.objectMode] - specifies whether a stream should operate in object mode\n* @param {(string|null)} [options.encoding] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.allowHalfOpen] - specifies whether the stream should remain open even if one side ends\n* @param {boolean} [options.readableObjectMode] - specifies whether the readable side should be in object mode\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'sep': '\\t',\n* 'objectMode': true\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, 'sep' ) ) {\n\t\topts.sep = options.sep;\n\t\tif ( !isString( opts.sep ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'sep', opts.sep ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'objectMode' ) ) {\n\t\topts.objectMode = options.objectMode;\n\t\tif ( !isBoolean( opts.objectMode ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'objectMode', opts.objectMode ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'readableObjectMode' ) ) {\n\t\topts.readableObjectMode = options.readableObjectMode;\n\t\tif ( !isBoolean( opts.readableObjectMode ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'readableObjectMode', opts.readableObjectMode ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'encoding' ) ) {\n\t\topts.encoding = options.encoding;\n\t\tif ( !isString( opts.encoding ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'encoding', opts.encoding ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'allowHalfOpen' ) ) {\n\t\topts.allowHalfOpen = options.allowHalfOpen;\n\t\tif ( !isBoolean( opts.allowHalfOpen ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'allowHalfOpen', opts.allowHalfOpen ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'highWaterMark' ) ) {\n\t\topts.highWaterMark = options.highWaterMark;\n\t\tif ( !isNonNegative( opts.highWaterMark ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a nonnegative number. Option: `%s`.', 'highWaterMark', opts.highWaterMark ) );\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/**\n* Transform stream which joins streamed data.\n*\n* @module @stdlib/streams-node-join\n*\n* @example\n* import stdout from '@stdlib/streams-node-stdout';\n* import joinStream from '@stdlib/streams-node-join';\n*\n* var stream = joinStream();\n*\n* stream.pipe( stdout );\n*\n* stream.write( '1' );\n* stream.write( '2' );\n* stream.write( '3' );\n*\n* stream.end();\n*\n* // prints: '1\\n2\\n3'\n*\n* @example\n* import joinStream from '@stdlib/streams-node-join';\n*\n* var opts = {\n* 'sep': '\\t',\n* 'objectMode': true,\n* 'encoding': 'utf8',\n* 'highWaterMark': 64\n* };\n*\n* var factory = joinStream.factory( opts );\n*\n* // Create 10 identically configured streams...\n* var streams = [];\n* var i;\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( factory() );\n* }\n*\n* @example\n* import stdout from '@stdlib/streams-node-stdout';\n* import joinStream from '@stdlib/streams-node-join';\n*\n* var stream = joinStream.objectMode({\n* 'sep': ','\n* });\n*\n* stream.pipe( stdout );\n*\n* stream.write( 'a' );\n* stream.write( 'b' );\n* stream.write( 'c' );\n*\n* stream.end();\n*\n* // prints: 'a,b,c'\n*/\n\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport objectMode from './object_mode.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'objectMode', objectMode );\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 isObject from '@stdlib/assert-is-plain-object';\nimport format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport Stream from './main.js';\n\n\n// MAIN //\n\n/**\n* Returns a join stream with `objectMode` set to `true`.\n*\n* @param {Options} [options] - stream options\n* @param {string} [options.sep='\\n'] - separator used to join streamed data\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.allowHalfOpen=false] - specifies whether the stream should remain open even if one side ends\n* @param {boolean} [options.readableObjectMode=false] - specifies whether the readable side should be in object mode\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {JoinStream} join stream\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n*\n* function log( chunk ) {\n* console.log( chunk.toString() );\n* }\n*\n* var stream = objectMode({\n* 'sep': ','\n* });\n*\n* stream.pipe( inspectStream( log ) );\n*\n* stream.write( 'a' );\n* stream.write( 'b' );\n* stream.write( 'c' );\n*\n* stream.end();\n*\n* // prints: 'a,b,c'\n*/\nfunction objectMode( options ) {\n\tvar opts;\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\topts = assign( {}, options );\n\t} else {\n\t\topts = {};\n\t}\n\topts.objectMode = true;\n\treturn new Stream( opts );\n}\n\n\n// EXPORTS //\n\nexport default objectMode;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport Stream from './main.js';\n\n\n// MAIN //\n\n/**\n* Creates a reusable join stream factory.\n*\n* @param {Options} [options] - stream options\n* @param {string} [options.sep='\\n'] - separator used to join streamed data\n* @param {boolean} [options.objectMode=false] - specifies whether a stream should operate in object mode\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.allowHalfOpen=false] - specifies whether the stream should remain open even if one side ends\n* @param {boolean} [options.readableObjectMode=false] - specifies whether the readable side should be in object mode\n* @throws {TypeError} options argument must be an object\n* @returns {Function} join stream factory\n*\n* @example\n* var opts = {\n* 'sep': '\\t',\n* 'objectMode': true,\n* 'encoding': 'utf8',\n* 'highWaterMark': 64\n* };\n*\n* var factory = streamFactory( opts );\n*\n* // Create 10 identically configured streams...\n* var streams = [];\n* var i;\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( factory() );\n* }\n*/\nfunction streamFactory( options ) {\n\tvar opts;\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\topts = assign( {}, options );\n\t} else {\n\t\topts = {};\n\t}\n\treturn joinStream;\n\n\t/**\n\t* Creates a transform stream for joining streamed data.\n\t*\n\t* @private\n\t* @throws {TypeError} must provide valid options\n\t* @returns {JoinStream} join stream\n\t*/\n\tfunction joinStream() {\n\t\treturn new Stream( opts );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default streamFactory;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 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 '@stdlib/assert-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) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// MAIN //\n\nvar debug = logger( 'split-stream' );\n\n\n// EXPORTS //\n\nexport default debug;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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';\n\n\n// MAIN //\n\n/**\n* Re-decodes a UTF-8 string according to a specified encoding.\n*\n* @private\n* @param {string} str - UTF-8 string to decode\n* @param {string} enc - string encoding\n* @returns {string} decoded string\n*/\nfunction decode( str, enc ) {\n\t// Check if we need to re-decode the string to something other than 'utf8'...\n\tif ( enc === 'utf8' || enc === 'buffer' ) {\n\t\treturn str;\n\t}\n\tstr = string2buffer( str );\n\tif ( enc ) {\n\t\treturn str.toString( enc );\n\t}\n\treturn str.toString();\n}\n\n\n// EXPORTS //\n\nexport default decode;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar Transform = require( 'readable-stream' ).Transform;\nimport assign from '@stdlib/object-assign';\nimport inherit from '@stdlib/utils-inherit';\nimport setNonEnumerable from '@stdlib/utils-define-nonenumerable-property';\nimport setNonEnumerableReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport Buffer from '@stdlib/buffer-ctor';\nimport nextTick from '@stdlib/utils-next-tick';\nimport DEFAULTS from './defaults.json';\nimport validate from './validate.js';\nimport debug from './debug.js';\nimport decode from './decode.js';\n\n\n// VARIABLES //\n\nvar RE = /\\r?\\n/;\n\n\n// FUNCTIONS //\n\n/**\n* Implements the `_transform` method.\n*\n* @private\n* @param {(Uint8Array|Buffer|string)} chunk - streamed chunk\n* @param {string} encoding - Buffer encoding\n* @param {Callback} clbk - callback to invoke after transforming the streamed chunk\n*/\nfunction transform( chunk, encoding, clbk ) {\n\t/* eslint-disable no-invalid-this */\n\tvar splits;\n\tvar split;\n\tvar len;\n\tvar i;\n\n\tthis._idx += 1;\n\tdebug( 'Received a new chunk. Chunk: %s. Encoding: %s. Index: %d.', chunk.toString(), encoding, this._idx );\n\tif ( encoding === 'buffer' ) {\n\t\t// Default Buffer decoding is 'utf8':\n\t\tchunk = chunk.toString();\n\t}\n\telse if ( encoding !== 'utf8' ) {\n\t\t// Decode the chunk as a 'utf8' string...\n\t\tchunk = new Buffer( chunk, encoding );\n\t\tchunk = chunk.toString( 'utf8' );\n\t}\n\t// Split the chunk:\n\tsplits = chunk.split( this._sep );\n\tdebug( 'Splits: %s. Index: %d.', JSON.stringify( splits ), this._idx );\n\n\t// How many splits do we have? We do not count the last \"split\", as it may be incomplete...\n\tlen = splits.length - 1;\n\tdebug( '%s splits. Index: %d.', len, this._idx );\n\n\t// If we do not have any splits, add the chunk to the buffer and wait for more data...\n\tif ( len === 0 ) {\n\t\tdebug( 'No splits. Index: %d.', this._idx );\n\t\tthis._buffer += splits[ len ];\n\t}\n\t// If we have split data, concat any previous partial split, re-decode (if need be) each split according to its original encoding, push each split to the destination, and set anything leftover as the new split buffer...\n\telse {\n\t\tdebug( 'Processing splits. Index: %d.', this._index );\n\t\tsplit = this._buffer + splits[ 0 ];\n\t\tsplit = decode( split, encoding );\n\n\t\tdebug( 'Split %d: %s. Index: %d.', 0, split.toString(), this._idx );\n\t\tthis.push( split, encoding );\n\t\tfor ( i = 1; i < len; i++ ) {\n\t\t\tsplit = decode( splits[ i ], encoding );\n\t\t\tdebug( 'Split %d: %s. Index: %d.', i, split.toString(), this._idx );\n\t\t\tthis.push( split, encoding );\n\t\t}\n\t\tdebug( 'Remaining split: %s.', splits[len].toString() );\n\t\tthis._buffer = splits[ len ];\n\t}\n\tclbk();\n\n\t/* eslint-enable no-invalid-this */\n}\n\n/**\n* Implements the `_flush` method.\n*\n* @private\n* @param {Callback} clbk - callback to invoke after any final processing\n*/\nfunction flush( clbk ) {\n\t/* eslint-disable no-invalid-this */\n\tvar split = this._buffer;\n\tif ( split ) {\n\t\tdebug( 'Processing final split...' );\n\t\tsplit = decode( split, this._encoding );\n\t\tthis.push( split, this._encoding );\n\t}\n\tdebug( 'Flushing the stream...' );\n\tclbk();\n\n\t/* eslint-enable no-invalid-this */\n}\n\n/**\n* Gracefully destroys a stream, providing backward compatibility.\n*\n* @private\n* @param {Object} [error] - optional error message\n* @returns {SplitStream} Stream instance\n*/\nfunction destroy( error ) {\n\t/* eslint-disable no-invalid-this */\n\tvar self;\n\tif ( this._destroyed ) {\n\t\tdebug( 'Attempted to destroy an already destroyed stream.' );\n\t\treturn this;\n\t}\n\tself = this;\n\tthis._destroyed = true;\n\n\tnextTick( close );\n\n\treturn this;\n\n\t/**\n\t* Closes a stream.\n\t*\n\t* @private\n\t*/\n\tfunction close() {\n\t\tif ( error ) {\n\t\t\tdebug( 'Stream was destroyed due to an error. Error: %s.', JSON.stringify( error ) );\n\t\t\tself.emit( 'error', error );\n\t\t}\n\t\tdebug( 'Closing the stream...' );\n\t\tself.emit( 'close' );\n\t}\n\n\t/* eslint-enable no-invalid-this */\n}\n\n\n// MAIN //\n\n/**\n* Split stream constructor.\n*\n* @constructor\n* @param {Options} [options] - stream options\n* @param {(string|RegExp)} [options.sep=/\\r?\\n/] - separator used to split streamed data\n* @param {boolean} [options.objectMode=false] - specifies whether a stream should operate in object mode\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.allowHalfOpen=false] - specifies whether the stream should remain open even if one side ends\n* @param {boolean} [options.writableObjectMode=false] - specifies whether the writable side should be in object mode\n* @returns {SplitStream} split stream\n*\n* @example\n* var stream = new SplitStream();\n*\n* stream.write( '1\\n2\\n3' );\n* stream.end();\n*/\nfunction SplitStream( options ) {\n\tvar opts;\n\tvar err;\n\tif ( !( this instanceof SplitStream ) ) {\n\t\tif ( arguments.length ) {\n\t\t\treturn new SplitStream( options );\n\t\t}\n\t\treturn new SplitStream();\n\t}\n\topts = assign( {}, DEFAULTS );\n\tif ( arguments.length ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t}\n\t// The stream's readable state should always be in object mode to prevent split data from being buffered (concatenated) and no longer being separated...\n\topts.readableObjectMode = true;\n\n\t// The stream converts each chunk into a string so no need to encode strings written to the split stream as Buffer objects:\n\topts.decodeStrings = false;\n\n\t// Make the stream a Transform stream:\n\tdebug( 'Creating a transform stream configured with the following options: %s.', JSON.stringify( opts ) );\n\tTransform.call( this, opts );\n\n\t// Cache the separator:\n\tsetNonEnumerableReadOnly( this, '_sep', ( opts.sep === null ) ? RE : opts.sep );\n\n\t// The destruction state:\n\tsetNonEnumerable( this, '_destroyed', false );\n\n\t// Cache the encoding:\n\tsetNonEnumerableReadOnly( this, '_encoding', opts.encoding );\n\n\t// Buffer for storing partial splits:\n\tsetNonEnumerable( this, '_buffer', '' );\n\n\t// Chunk counter:\n\tsetNonEnumerable( this, '_idx', -1 );\n\n\treturn this;\n}\n\n/*\n* Inherit from the `Transform` prototype.\n*/\ninherit( SplitStream, Transform );\n\n/**\n* Implements the `_transform` method.\n*\n* @private\n* @name _transform\n* @memberof SplitStream.prototype\n* @type {Function}\n* @param {(Buffer|string)} chunk - streamed chunk\n* @param {string} encoding - Buffer encoding\n* @param {Callback} clbk - callback to invoke after transforming the streamed chunk\n*/\nsetNonEnumerableReadOnly( SplitStream.prototype, '_transform', transform );\n\n/**\n* Implements the `_flush` method.\n*\n* @private\n* @name _flush\n* @memberof SplitStream.prototype\n* @type {Function}\n* @param {Callback} clbk - callback to invoke after any final processing\n*/\nsetNonEnumerableReadOnly( SplitStream.prototype, '_flush', flush );\n\n/**\n* Gracefully destroys a stream, providing backward compatibility.\n*\n* @name destroy\n* @memberof SplitStream.prototype\n* @type {Function}\n* @param {Object} [error] - optional error message\n* @returns {SplitStream} Stream instance\n*/\nsetNonEnumerableReadOnly( SplitStream.prototype, 'destroy', destroy );\n\n\n// EXPORTS //\n\nexport default SplitStream;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isNonNegative } from '@stdlib/assert-is-nonnegative-number';\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport isRegExp from '@stdlib/assert-is-regexp';\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|RegExp)} [options.sep] - separator used to split streamed data\n* @param {boolean} [options.objectMode] - specifies whether stream should operate in object mode\n* @param {(string|null)} [options.encoding] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.allowHalfOpen] - specifies whether the stream should remain open even if one side ends\n* @param {boolean} [options.writableObjectMode] - specifies whether the writable side should be in object mode\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'sep': '\\t',\n* 'objectMode': true\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, 'sep' ) ) {\n\t\topts.sep = options.sep;\n\t\tif (\n\t\t\t!isString( opts.sep ) &&\n\t\t\t!isRegExp( opts.sep )\n\t\t) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be either a string or a regular expression. Option: `%s`.', 'sep', opts.sep ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'objectMode' ) ) {\n\t\topts.objectMode = options.objectMode;\n\t\tif ( !isBoolean( opts.objectMode ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'objectMode', opts.objectMode ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'writableObjectMode' ) ) {\n\t\topts.writableObjectMode = options.writableObjectMode;\n\t\tif ( !isBoolean( opts.writableObjectMode ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'writableObjectMode', opts.writableObjectMode ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'encoding' ) ) {\n\t\topts.encoding = options.encoding;\n\t\tif ( !isString( opts.encoding ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'encoding', opts.encoding ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'allowHalfOpen' ) ) {\n\t\topts.allowHalfOpen = options.allowHalfOpen;\n\t\tif ( !isBoolean( opts.allowHalfOpen ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'allowHalfOpen', opts.allowHalfOpen ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'highWaterMark' ) ) {\n\t\topts.highWaterMark = options.highWaterMark;\n\t\tif ( !isNonNegative( opts.highWaterMark ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a nonnegative number. Option: `%s`.', 'highWaterMark', opts.highWaterMark ) );\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/**\n* Transform stream which splits streamed data.\n*\n* @module @stdlib/streams-node-split\n*\n* @example\n* import stdout from '@stdlib/streams-node-stdout';\n* import splitStream from '@stdlib/streams-node-split';\n*\n* var stream = splitStream();\n*\n* stream.pipe( stdout );\n*\n* stream.write( '1\\n2\\n3' );\n* stream.end();\n* // => '1' => '2' => '3'\n*\n* @example\n* import splitStream from '@stdlib/streams-node-split';\n*\n* var opts = {\n* 'sep': '\\t',\n* 'objectMode': true,\n* 'encoding': 'utf8',\n* 'highWaterMark': 64\n* };\n*\n* var factory = splitStream.factory( opts );\n*\n* // Create 10 identically configured streams...\n* var streams = [];\n* var i;\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( factory() );\n* }\n*\n* @example\n* import stdout from '@stdlib/streams-node-stdout';\n* import splitStream from '@stdlib/streams-node-split';\n*\n* var stream = splitStream.objectMode({\n* 'sep': ','\n* });\n*\n* stream.pipe( stdout );\n*\n* stream.write( 'a,b,c' );\n* stream.end();\n* // => 'a' => 'b' => 'c'\n*/\n\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport objectMode from './object_mode.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'objectMode', objectMode );\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 isObject from '@stdlib/assert-is-plain-object';\nimport format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport Stream from './main.js';\n\n\n// MAIN //\n\n/**\n* Returns a stream with `objectMode` set to `true`.\n*\n* @param {Options} [options] - stream options\n* @param {(string|RegExp)} [options.sep=/\\r?\\n/] - separator used to split streamed data\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.allowHalfOpen=false] - specifies whether the stream should remain open even if one side ends\n* @param {boolean} [options.writableObjectMode=false] - specifies whether the writable side should be in object mode\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {SplitStream} split stream\n*\n* @example\n* var stream = objectMode({\n* 'sep': ','\n* });\n*\n* stream.write( 'a,b,c' );\n* stream.end();\n*/\nfunction objectMode( options ) {\n\tvar opts;\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\topts = assign( {}, options );\n\t} else {\n\t\topts = {};\n\t}\n\topts.objectMode = true;\n\treturn new Stream( opts );\n}\n\n\n// EXPORTS //\n\nexport default objectMode;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport Stream from './main.js';\n\n\n// MAIN //\n\n/**\n* Creates a reusable stream factory.\n*\n* @param {Options} [options] - stream options\n* @param {(string|RegExp)} [options.sep=/\\r?\\n/] - separator used to split streamed data\n* @param {boolean} [options.objectMode=false] - specifies whether a stream should operate in object mode\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.allowHalfOpen=false] - specifies whether the stream should remain open even if one side ends\n* @param {boolean} [options.writableObjectMode=false] - specifies whether the writable side should be in object mode\n* @throws {TypeError} options argument must be an object\n* @returns {Function} stream factory\n*\n* @example\n* var opts = {\n* 'sep': '\\t',\n* 'objectMode': true,\n* 'encoding': 'utf8'\n* };\n*\n* var factory = streamFactory( opts );\n*\n* // Create 10 identically configured streams...\n* var streams = [];\n* var i;\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( factory() );\n* }\n*/\nfunction streamFactory( options ) {\n\tvar opts;\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\topts = assign( {}, options );\n\t} else {\n\t\topts = {};\n\t}\n\treturn splitStream;\n\n\t/**\n\t* Creates a transform stream for splitting streamed data.\n\t*\n\t* @private\n\t* @throws {TypeError} must provide valid options\n\t* @returns {SplitStream} split stream\n\t*/\n\tfunction splitStream() {\n\t\treturn new Stream( opts );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default streamFactory;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar proc = require( 'process' );\n\n\n// EXPORTS //\n\nexport default proc.stderr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar proc = require( 'process' );\n\n\n// EXPORTS //\n\nexport default proc.stdin;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar proc = require( 'process' );\n\n\n// EXPORTS //\n\nexport default proc.stdout;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isFunction from '@stdlib/assert-is-function';\nimport { isPrimitive as isBoolean } from '@stdlib/assert-is-boolean';\nimport { isPrimitive as isNonNegative } from '@stdlib/assert-is-nonnegative-number';\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 {Function} [options.transform] - callback to invoke upon receiving a new chunk\n* @param {Function} [options.flush] - callback to invoke after receiving all chunks and prior to the stream closing\n* @param {boolean} [options.objectMode] - specifies whether a stream should operate in object mode\n* @param {(string|null)} [options.encoding] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.allowHalfOpen] - specifies whether the stream should remain open even if one side ends\n* @param {boolean} [options.decodeStrings] - specifies whether to decode `strings` into `Buffer` objects when writing\n* @returns {(Error|null)} null or an error object\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, 'transform' ) ) {\n\t\topts.transform = options.transform;\n\t\tif ( !isFunction( opts.transform ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a function. Option: `%s`.', 'transform', opts.transform ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'flush' ) ) {\n\t\topts.flush = options.flush;\n\t\tif ( !isFunction( opts.flush ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a function. Option: `%s`.', 'flush', opts.flush ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'objectMode' ) ) {\n\t\topts.objectMode = options.objectMode;\n\t\tif ( !isBoolean( opts.objectMode ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'objectMode', opts.objectMode ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'encoding' ) ) {\n\t\topts.encoding = options.encoding;\n\t\tif ( !isString( opts.encoding ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'encoding', opts.encoding ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'allowHalfOpen' ) ) {\n\t\topts.allowHalfOpen = options.allowHalfOpen;\n\t\tif ( !isBoolean( opts.allowHalfOpen ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'allowHalfOpen', opts.allowHalfOpen ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'highWaterMark' ) ) {\n\t\topts.highWaterMark = options.highWaterMark;\n\t\tif ( !isNonNegative( opts.highWaterMark ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a nonnegative number. Option: `%s`.', 'highWaterMark', opts.highWaterMark ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'decodeStrings' ) ) {\n\t\topts.decodeStrings = options.decodeStrings;\n\t\tif ( !isBoolean( opts.decodeStrings ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'decodeStrings', opts.decodeStrings ) );\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\nvar logger = require( 'debug' );\nimport nextTick from '@stdlib/utils-next-tick';\n\n\n// VARIABLES //\n\nvar debug = logger( 'transform-stream:destroy' );\n\n\n// MAIN //\n\n/**\n* Gracefully destroys a stream, providing backward compatibility.\n*\n* @private\n* @param {Object} [error] - optional error message\n* @returns {Stream} stream instance\n*/\nfunction destroy( error ) {\n\t/* eslint-disable no-invalid-this */\n\tvar self;\n\tif ( this._destroyed ) {\n\t\tdebug( 'Attempted to destroy an already destroyed stream.' );\n\t\treturn this;\n\t}\n\tself = this;\n\tthis._destroyed = true;\n\n\tnextTick( close );\n\n\treturn this;\n\n\t/**\n\t* Closes a stream.\n\t*\n\t* @private\n\t*/\n\tfunction close() {\n\t\tif ( error ) {\n\t\t\tdebug( 'Stream was destroyed due to an error. Error: %s.', JSON.stringify( error ) );\n\t\t\tself.emit( 'error', error );\n\t\t}\n\t\tdebug( 'Closing the stream...' );\n\t\tself.emit( 'close' );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default destroy;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'transform-stream:transform' );\n\n\n// MAIN //\n\n/**\n* Implements the `_transform` method as a pass through.\n*\n* @private\n* @param {(Uint8Array|Buffer|string)} chunk - streamed chunk\n* @param {string} encoding - Buffer encoding\n* @param {Callback} clbk - callback to invoke after transforming the streamed chunk\n*/\nfunction transform( chunk, encoding, clbk ) {\n\tdebug( 'Received a new chunk. Chunk: %s. Encoding: %s.', chunk.toString(), encoding );\n\tclbk( null, chunk );\n}\n\n\n// EXPORTS //\n\nexport default transform;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nvar Transform = require( 'readable-stream' ).Transform;\nimport inherit from '@stdlib/utils-inherit';\nimport assign from '@stdlib/object-assign';\nimport DEFAULTS from './defaults.json';\nimport validate from './validate.js';\nimport destroy from './destroy.js';\nimport _transform from './_transform.js'; // eslint-disable-line no-underscore-dangle\n\n\n// VARIABLES //\n\nvar debug = logger( 'transform-stream:main' );\n\n\n// MAIN //\n\n/**\n* Transform stream constructor.\n*\n* @constructor\n* @param {Options} [options] - stream options\n* @param {Function} [options.transform] - callback to invoke upon receiving a new chunk\n* @param {Function} [options.flush] - callback to invoke after receiving all chunks and prior to the stream closing\n* @param {boolean} [options.objectMode=false] - specifies whether stream should operate in object mode\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.allowHalfOpen=false] - specifies whether the stream should remain open even if one side ends\n* @param {boolean} [options.decodeStrings=true] - specifies whether to decode `strings` into `Buffer` objects when writing\n* @throws {TypeError} must provide valid options\n* @returns {TransformStream} transform stream\n*\n* @example\n* import stdout from '@stdlib/streams-node-stdout';\n*\n* function transform( chunk, enc, clbk ) {\n* clbk( null, chunk.toString()+'\\n' );\n* }\n*\n* var opts = {\n* 'transform': transform\n* };\n* var stream = new TransformStream( opts );\n*\n* stream.pipe( stdout );\n*\n* stream.write( '1' );\n* stream.write( '2' );\n* stream.write( '3' );\n*\n* stream.end();\n*\n* // prints: '1\\n2\\n3\\n'\n*/\nfunction TransformStream( options ) { // eslint-disable-line stdlib/no-redeclare\n\tvar opts;\n\tvar err;\n\tif ( !( this instanceof TransformStream ) ) {\n\t\tif ( arguments.length ) {\n\t\t\treturn new TransformStream( options );\n\t\t}\n\t\treturn new TransformStream();\n\t}\n\topts = assign( {}, DEFAULTS );\n\tif ( arguments.length ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t}\n\tdebug( 'Creating a transform stream configured with the following options: %s.', JSON.stringify( opts ) );\n\tTransform.call( this, opts );\n\tthis._destroyed = false;\n\tif ( opts.transform ) {\n\t\tthis._transform = opts.transform;\n\t} else {\n\t\tthis._transform = _transform;\n\t}\n\tif ( opts.flush ) {\n\t\tthis._flush = opts.flush;\n\t}\n\treturn this;\n}\n\n/*\n* Inherit from the `Transform` prototype.\n*/\ninherit( TransformStream, Transform );\n\n/**\n* Gracefully destroys a stream, providing backward compatibility.\n*\n* @name destroy\n* @memberof TransformStream.prototype\n* @type {Function}\n* @param {Object} [error] - optional error message\n* @returns {TransformStream} stream instance\n*/\nTransformStream.prototype.destroy = destroy;\n\n\n// EXPORTS //\n\nexport default TransformStream;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nvar Transform = require( 'readable-stream' ).Transform;\nimport inherit from '@stdlib/utils-inherit';\nimport assign from '@stdlib/object-assign';\nimport DEFAULTS from './defaults.json';\nimport validate from './validate.js';\nimport destroy from './destroy.js';\nimport _transform from './_transform.js'; // eslint-disable-line no-underscore-dangle\n\n\n// VARIABLES //\n\nvar debug = logger( 'transform-stream:ctor' );\n\n\n// MAIN //\n\n/**\n* Transform stream constructor factory.\n*\n* @param {Options} [options] - stream options\n* @param {Function} [options.transform] - callback to invoke upon receiving a new chunk\n* @param {Function} [options.flush] - callback to invoke after receiving all chunks and prior to the stream closing\n* @param {boolean} [options.objectMode=false] - specifies whether a stream should operate in object mode\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.allowHalfOpen=false] - specifies whether the stream should remain open even if one side ends\n* @param {boolean} [options.decodeStrings=true] - specifies whether to decode `strings` into `Buffer` objects when writing\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {Function} Transform stream constructor\n*\n* @example\n* import stdout from '@stdlib/streams-node-stdout';\n*\n* function transform( chunk, enc, clbk ) {\n* clbk( null, chunk.toString()+'\\n' );\n* }\n*\n* var opts = {\n* 'transform': transform\n* };\n*\n* var TransformStream = ctor( opts );\n*\n* var stream = new TransformStream();\n*\n* stream.pipe( stdout );\n*\n* stream.write( '1' );\n* stream.write( '2' );\n* stream.write( '3' );\n*\n* stream.end();\n*\n* // prints: '1\\n2\\n3\\n'\n*/\nfunction ctor( options ) {\n\tvar transform;\n\tvar copts;\n\tvar err;\n\n\tcopts = assign( {}, DEFAULTS );\n\tif ( arguments.length ) {\n\t\terr = validate( copts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t}\n\tif ( copts.transform ) {\n\t\ttransform = copts.transform;\n\t} else {\n\t\ttransform = _transform;\n\t}\n\t/**\n\t* Transform stream constructor.\n\t*\n\t* @private\n\t* @constructor\n\t* @param {Options} [options] - stream options\n\t* @param {boolean} [options.objectMode=false] - specifies whether a stream should operate in object mode\n\t* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to `strings`\n\t* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n\t* @param {boolean} [options.allowHalfOpen=false] - specifies whether the stream should remain open even if one side ends\n\t* @param {boolean} [options.decodeStrings=true] - specifies whether to decode `strings` into `Buffer` objects when writing\n\t* @throws {TypeError} options argument must be an object\n\t* @throws {TypeError} must provide valid options\n\t* @returns {TransformStream} transform stream\n\t*\n\t* @example\n\t* import stdout from '@stdlib/streams-node-stdout';\n\t*\n\t* var stream = new TransformStream();\n\t*\n\t* stream.pipe( stdout );\n\t*\n\t* stream.write( '1' );\n\t* stream.write( '2' );\n\t* stream.write( '3' );\n\t*\n\t* stream.end();\n\t*\n\t* // prints: '1\\n2\\n3\\n'\n\t*/\n\tfunction TransformStream( options ) {\n\t\tvar opts;\n\t\tvar err;\n\t\tif ( !( this instanceof TransformStream ) ) {\n\t\t\tif ( arguments.length ) {\n\t\t\t\treturn new TransformStream( options );\n\t\t\t}\n\t\t\treturn new TransformStream();\n\t\t}\n\t\topts = assign( {}, copts );\n\t\tif ( arguments.length ) {\n\t\t\terr = validate( opts, options );\n\t\t\tif ( err ) {\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t}\n\t\tdebug( 'Creating a transform stream configured with the following options: %s.', JSON.stringify( opts ) );\n\t\tTransform.call( this, opts );\n\t\tthis._destroyed = false;\n\t\treturn this;\n\t}\n\n\t/**\n\t* Inherit from the `Transform` prototype.\n\t*/\n\tinherit( TransformStream, Transform );\n\n\t/**\n\t* Implements the `_transform` method.\n\t*\n\t* @private\n\t* @name _transform\n\t* @memberof TransformStream.prototype\n\t* @type {Function}\n\t* @param {(Buffer|string)} chunk - streamed chunk\n\t* @param {string} encoding - Buffer encoding\n\t* @param {Callback} clbk - callback to invoke after transforming the streamed chunk\n\t*/\n\tTransformStream.prototype._transform = transform; // eslint-disable-line no-underscore-dangle\n\n\tif ( copts.flush ) {\n\t\t/**\n\t\t* Implements the `_flush` method.\n\t\t*\n\t\t* @private\n\t\t* @name _flush\n\t\t* @memberof TransformStream.prototype\n\t\t* @type {Function}\n\t\t* @param {Callback} callback to invoke after performing flush tasks\n\t\t*/\n\t\tTransformStream.prototype._flush = copts.flush; // eslint-disable-line no-underscore-dangle\n\t}\n\n\t/**\n\t* Gracefully destroys a stream, providing backward compatibility.\n\t*\n\t* @private\n\t* @name destroy\n\t* @memberof TransformStream.prototype\n\t* @type {Function}\n\t* @param {Object} [error] - optional error message\n\t* @returns {TransformStream} stream instance\n\t*/\n\tTransformStream.prototype.destroy = destroy;\n\n\treturn TransformStream;\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* Transform stream.\n*\n* @module @stdlib/streams-node-transform\n*\n* @example\n* import stdout from '@stdlib/streams-node-stdout';\n* import transformStream from '@stdlib/streams-node-transform';\n*\n* function transform( chunk, enc, clbk ) {\n* clbk( null, chunk.toString()+'\\n' );\n* }\n*\n* var opts = {\n* 'transform': transform\n* };\n* var stream = transformStream( opts );\n*\n* stream.pipe( stdout );\n*\n* stream.write( '1' );\n* stream.write( '2' );\n* stream.write( '3' );\n*\n* stream.end();\n* // => '1\\n2\\n3\\n'\n*\n* @example\n* import transformStream from '@stdlib/streams-node-transform';\n*\n* function transform( chunk, enc, clbk ) {\n* clbk( null, chunk.toString()+'\\n' );\n* }\n*\n* var opts = {\n* 'objectMode': true,\n* 'encoding': 'utf8',\n* 'highWaterMark': 64,\n* 'decodeStrings': false\n* };\n*\n* var factory = transformStream.factory( opts );\n*\n* // Create 10 identically configured streams...\n* var streams = [];\n* var i;\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( factory( transform ) );\n* }\n*\n* @example\n* import stdout from '@stdlib/streams-node-stdout';\n* import transformStream from '@stdlib/streams-node-transform';\n*\n* function stringify( chunk, enc, clbk ) {\n* clbk( null, JSON.stringify( chunk ) );\n* }\n*\n* function newline( chunk, enc, clbk ) {\n* clbk( null, chunk+'\\n' );\n* }\n*\n* var s1 = transformStream.objectMode({\n* 'transform': stringify\n* });\n*\n* var s2 = transformStream.objectMode({\n* 'transform': newline\n* });\n*\n* s1.pipe( s2 ).pipe( stdout );\n*\n* s1.write( {'value': 'a'} );\n* s1.write( {'value': 'b'} );\n* s1.write( {'value': 'c'} );\n*\n* s1.end();\n* // => '{\"value\":\"a\"}\\n{\"value\":\"b\"}\\n{\"value\":\"c\"}\\n'\n*\n* @example\n* import stdout from '@stdlib/streams-node-stdout';\n* import transformStream from '@stdlib/streams-node-transform';\n*\n* function transform( chunk, enc, clbk ) {\n* clbk( null, chunk.toString()+'\\n' );\n* }\n*\n* var opts = {\n* 'transform': transform\n* };\n*\n* var Stream = transformStream.ctor( opts );\n*\n* var stream = new Stream();\n*\n* stream.pipe( stdout );\n*\n* stream.write( '1' );\n* stream.write( '2' );\n* stream.write( '3' );\n*\n* stream.end();\n* // => '1\\n2\\n3\\n'\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport objectMode from './object_mode.js';\nimport factory from './factory.js';\nimport ctor from './ctor.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'objectMode', objectMode );\nsetReadOnly( main, 'factory', factory );\nsetReadOnly( main, 'ctor', ctor );\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 isObject from '@stdlib/assert-is-plain-object';\nimport format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport Stream from './main.js';\n\n\n// MAIN //\n\n/**\n* Returns a transform stream with `objectMode` set to `true`.\n*\n* @param {Options} [options] - stream options\n* @param {Function} [options.transform] - callback to invoke upon receiving a new chunk\n* @param {Function} [options.flush] - callback to invoke after receiving all chunks and prior to the stream closing\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.allowHalfOpen=false] - specifies whether the stream should remain open even if one side ends\n* @param {boolean} [options.decodeStrings=true] - specifies whether to decode `strings` into `Buffer` objects when writing\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {TransformStream} transform stream\n*\n* @example\n* import stdout from '@stdlib/streams-node-stdout';\n*\n* function stringify( chunk, enc, clbk ) {\n* clbk( null, JSON.stringify( chunk ) );\n* }\n*\n* function newline( chunk, enc, clbk ) {\n* clbk( null, chunk+'\\n' );\n* }\n*\n* var s1 = objectMode({\n* 'transform': stringify\n* });\n*\n* var s2 = objectMode({\n* 'transform': newline\n* });\n*\n* s1.pipe( s2 ).pipe( stdout );\n*\n* s1.write( {'value': 'a'} );\n* s1.write( {'value': 'b'} );\n* s1.write( {'value': 'c'} );\n*\n* s1.end();\n*\n* // prints: '{\"value\":\"a\"}\\n{\"value\":\"b\"}\\n{\"value\":\"c\"}\\n'\n*/\nfunction objectMode( options ) {\n\tvar opts;\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\topts = assign( {}, options );\n\t} else {\n\t\topts = {};\n\t}\n\topts.objectMode = true;\n\treturn new Stream( opts );\n}\n\n\n// EXPORTS //\n\nexport default objectMode;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport Stream from './main.js';\n\n\n// MAIN //\n\n/**\n* Creates a reusable transform stream factory.\n*\n* @param {Options} [options] - stream options\n* @param {boolean} [options.objectMode=false] - specifies whether a stream should operate in object mode\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.allowHalfOpen=false] - specifies whether the stream should remain open even if one side ends\n* @param {boolean} [options.decodeStrings=true] - specifies whether to decode `strings` into `Buffer` objects when writing\n* @throws {TypeError} options argument must be an object\n* @returns {Function} transform stream factory\n*\n* @example\n* function transform( chunk, enc, clbk ) {\n* clbk( null, chunk.toString()+'\\n' );\n* }\n*\n* var opts = {\n* 'objectMode': true,\n* 'encoding': 'utf8',\n* 'highWaterMark': 64,\n* 'decodeStrings': false\n* };\n*\n* var factory = streamFactory( opts );\n*\n* // Create 10 identically configured streams...\n* var streams = [];\n* var i;\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( factory( transform ) );\n* }\n*/\nfunction streamFactory( options ) {\n\tvar opts;\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\topts = assign( {}, options );\n\t} else {\n\t\topts = {};\n\t}\n\treturn createStream;\n\n\t/**\n\t* Creates a transform stream.\n\t*\n\t* @private\n\t* @param {Function} transform - callback to invoke upon receiving a new chunk\n\t* @param {Function} [flush] - callback to invoke after receiving all chunks and prior to the stream closing\n\t* @throws {TypeError} must provide valid options\n\t* @throws {TypeError} transform callback must be a function\n\t* @throws {TypeError} flush callback must be a function\n\t* @returns {TransformStream} transform stream\n\t*/\n\tfunction createStream( transform, flush ) {\n\t\topts.transform = transform;\n\t\tif ( arguments.length > 1 ) {\n\t\t\topts.flush = flush;\n\t\t} else {\n\t\t\tdelete opts.flush; // clear any previous `flush`\n\t\t}\n\t\treturn new Stream( opts );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default streamFactory;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\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 streams\n*/\nvar streams = {};\n\n/**\n* @name debugStream\n* @memberof streams\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/streams/node/debug}\n*/\nimport debugStream from '@stdlib/streams-node-debug';\nsetReadOnly( streams, 'debugStream', debugStream );\n\n/**\n* @name debugSinkStream\n* @memberof streams\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/streams/node/debug-sink}\n*/\nimport debugSinkStream from '@stdlib/streams-node-debug-sink';\nsetReadOnly( streams, 'debugSinkStream', debugSinkStream );\n\n/**\n* @name emptyStream\n* @memberof streams\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/streams/node/empty}\n*/\nimport emptyStream from '@stdlib/streams-node-empty';\nsetReadOnly( streams, 'emptyStream', emptyStream );\n\n/**\n* @name arrayStream\n* @memberof streams\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/streams/node/from-array}\n*/\nimport arrayStream from '@stdlib/streams-node-from-array';\nsetReadOnly( streams, 'arrayStream', arrayStream );\n\n/**\n* @name circularArrayStream\n* @memberof streams\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/streams/node/from-circular-array}\n*/\nimport circularArrayStream from '@stdlib/streams-node-from-circular-array';\nsetReadOnly( streams, 'circularArrayStream', circularArrayStream );\n\n/**\n* @name constantStream\n* @memberof streams\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/streams/node/from-constant}\n*/\nimport constantStream from '@stdlib/streams-node-from-constant';\nsetReadOnly( streams, 'constantStream', constantStream );\n\n/**\n* @name iteratorStream\n* @memberof streams\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/streams/node/from-iterator}\n*/\nimport iteratorStream from '@stdlib/streams-node-from-iterator';\nsetReadOnly( streams, 'iteratorStream', iteratorStream );\n\n/**\n* @name stridedArrayStream\n* @memberof streams\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/streams/node/from-strided-array}\n*/\nimport stridedArrayStream from '@stdlib/streams-node-from-strided-array';\nsetReadOnly( streams, 'stridedArrayStream', stridedArrayStream );\n\n/**\n* @name inspectStream\n* @memberof streams\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/streams/node/inspect}\n*/\nimport inspectStream from '@stdlib/streams-node-inspect';\nsetReadOnly( streams, 'inspectStream', inspectStream );\n\n/**\n* @name inspectSinkStream\n* @memberof streams\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/streams/node/inspect-sink}\n*/\nimport inspectSinkStream from '@stdlib/streams-node-inspect-sink';\nsetReadOnly( streams, 'inspectSinkStream', inspectSinkStream );\n\n/**\n* @name joinStream\n* @memberof streams\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/streams/node/join}\n*/\nimport joinStream from '@stdlib/streams-node-join';\nsetReadOnly( streams, 'joinStream', joinStream );\n\n/**\n* @name splitStream\n* @memberof streams\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/streams/node/split}\n*/\nimport splitStream from '@stdlib/streams-node-split';\nsetReadOnly( streams, 'splitStream', splitStream );\n\n/**\n* @name stderr\n* @memberof streams\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/streams/node/stderr}\n*/\nimport stderr from '@stdlib/streams-node-stderr';\nsetReadOnly( streams, 'stderr', stderr );\n\n/**\n* @name stdin\n* @memberof streams\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/streams/node/stdin}\n*/\nimport stdin from '@stdlib/streams-node-stdin';\nsetReadOnly( streams, 'stdin', stdin );\n\n/**\n* @name stdout\n* @memberof streams\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/streams/node/stdout}\n*/\nimport stdout from '@stdlib/streams-node-stdout';\nsetReadOnly( streams, 'stdout', stdout );\n\n/**\n* @name transformStream\n* @memberof streams\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/streams/node/transform}\n*/\nimport transformStream from '@stdlib/streams-node-transform';\nsetReadOnly( streams, 'transformStream', transformStream );\n\n\n// EXPORTS //\n\nexport default streams;\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","digits","f","parseFloat","toExponential","toFixed","toPrecision","spaces","fromCharCode","isArray","Array","isnan","initialize","flags","mapping","formatInterpolate","tokens","hasPeriod","flag","num","pos","j","TypeError","padZeros","indexOf","arguments","maxWidth","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","isBoolean","FLG","Symbol","hasToStringTagSupport","toStringTag","has","hasOwnProperty","hasOwnProp","property","Sym","toStrTag","hasToStringTag","v","isOwn","tag","nativeClass","Bool","Boolean","test","isPrimitive","isObject","self","window","globalThis","getGlobal","codegen","Function","GlobalThis","Self","Win","root","nodeList","document","childNodes","typedarray","Int8Array","reFunctionName","RE_FUNCTION_NAME","REGEXP","main$8","isObjectLike","isObjectLikeArray","predicate","len","arrayfun","isBuffer","_isBuffer","constructor","constructorName","name","ctor","ctorName","type","isFunction","typeOf","bool","assign","keys","isArguments","bool$a","detect","hasArgumentsClass","isString","valueOf","main$6","Number","x","isNan","FLOAT64_PINF","POSITIVE_INFINITY","FLOAT64_NINF","NEGATIVE_INFINITY","floor","isInteger","PINF","NINF","isInt","isEnumerableProperty","propertyIsEnumerable","hasStringEnumBug","isEnum","isArguments$1","MAX_TYPED_ARRAY_LENGTH","isCollection","MAX_LENGTH","arr","searchElement","fromIndex","isConstructorPrototype","w","hasAutomationEqualityBug","k","win","EXCLUDED_KEYS","check","HAS_BUILTIN","skipConstructor","skipPrototype","isFcn","p","HAS_ENUM_PROTO_BUG","HAS_NON_ENUM_PROPS_BUG","HAS_WINDOW","error","NON_ENUMERABLE","main$5","getOwnPropertySymbols","Obj","propertySymbols","enumerableProperties","tmp","isEnumerable","hasObjectAssign","target","source","key","to","assign$1","validate","create","Ctor","createObject$1","proto","inherit","superCtor","createObject","setNonEnumerableProperty","proc","require$$0","nextTick","clbk","getProto","getPrototypeOf","getProto$1","objectPrototype","isPlainObject","isPrototypeOf","ownProps","isNonNegativeNumber","debug","Transform","InspectStream","options","inspect","opts","this","DEFAULTS","objectMode","readableObjectMode","allowHalfOpen","highWaterMark","isNonNegative","writableObjectMode","JSON","stringify","setNonEnumerable","chunk","encoding","_idx","_inspect","_destroyed","emit","cb","Stream","NAMESPACE$1","NAMESPACE","DebugStream","log","logger","idx","Writable","InspectSinkStream","decodeStrings","defaultEncoding","DebugSinkStream","isError","Readable","EmptyStream","message","Buffer","string2buffer","from","string2buffer$1","ArrayStream","src","sep","serialize","dir","_i","_src","_stride","_objectMode","_serialize","_sep","concat","isNonNegativeInteger","CircularArrayStream","iter","_iter","hasUint8Array","Uint8Array","isUint8Array","globalScope$1","fcn","Global","VERSION","global","globalScope","versions","node","release","MAJOR","IS_NODE","split","version","hasArrayBuffer","ArrayBuffer","isArrayBuffer","GlobalUint8Array","UINT8_MAX","hasUint8ArraySupport","Uint8Array$1","arraybuffer2buffer","fromArray","hasFrom","buf","byteOffset","offset","byteLength","RangeError","arraybuffer2buffer$1","ConstantStream","buffer","_value","nargs","IteratorStream","iterator","t","next","isIteratorLike","_iterator","done","StridedArrayStream","N","stride","_N","_buffer","JoinStream","_encoding","_init","RegExp","isRegExp","decode","enc","SplitStream","splits","_index","stderr","stdin","stdout","transform","flush","destroy","require$$1","TransformStream","_transform","_flush","copts","streams","debugStream","debugSinkStream","emptyStream","arrayStream","circularArrayStream","constantStream","iteratorStream","stridedArrayStream","inspectStream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EAAMP,UAENK,GAyDb9I,GAAS6I,EAAiB5H,IAa1B4H,EAAgB5W,UAAU6W,WAAaL,EAElCO,EAAMN,QAUVG,EAAgB5W,UAAU8W,OAASC,EAAMN,OAa1CG,EAAgB5W,UAAU0W,QAAUA,GAE7BE,CACR,II5JI,IAAAI,GAAU,CAAG,SAUjBjR,EAAaiR,GAAS,cAAeC,IAUrClR,EAAaiR,GAAS,kBAAmBE,IAUzCnR,EAAaiR,GAAS,cAAeG,IAUrCpR,EAAaiR,GAAS,cAAeI,IAUrCrR,EAAaiR,GAAS,sBAAuBK,IAU7CtR,EAAaiR,GAAS,iBAAkBM,IAUxCvR,EAAaiR,GAAS,iBAAkBO,IAUxCxR,EAAaiR,GAAS,qBAAsBQ,IAU5CzR,EAAaiR,GAAS,gBAAiBS,IAUvC1R,EAAaiR,GAAS,oBAAqBU,IAU3C3R,EAAaiR,GAAS,aAAcW,IAUpC5R,EAAaiR,GAAS,cAAeY,IAUrC7R,EAAaiR,GAAS,SAAUX,IAUhCtQ,EAAaiR,GAAS,QAASV,IAU/BvQ,EAAaiR,GAAS,SAAUT,IAUhCxQ,EAAaiR,GAAS,kBAAmBa","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,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,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264]} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 15e948f..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import ns from '../docs/types/index'; -export = ns; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 0e8ca06..0000000 --- a/dist/index.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict";var e=require('@stdlib/utils-define-read-only-property/dist'),r={};e(r,"debugStream",require('@stdlib/streams-node-debug/dist'));e(r,"debugSinkStream",require('@stdlib/streams-node-debug-sink/dist'));e(r,"emptyStream",require('@stdlib/streams-node-empty/dist'));e(r,"arrayStream",require('@stdlib/streams-node-from-array/dist'));e(r,"circularArrayStream",require('@stdlib/streams-node-from-circular-array/dist'));e(r,"constantStream",require('@stdlib/streams-node-from-constant/dist'));e(r,"iteratorStream",require('@stdlib/streams-node-from-iterator/dist'));e(r,"stridedArrayStream",require('@stdlib/streams-node-from-strided-array/dist'));e(r,"inspectStream",require('@stdlib/streams-node-inspect/dist'));e(r,"inspectSinkStream",require('@stdlib/streams-node-inspect-sink/dist'));e(r,"joinStream",require('@stdlib/streams-node-join/dist'));e(r,"splitStream",require('@stdlib/streams-node-split/dist'));e(r,"stderr",require('@stdlib/streams-node-stderr/dist'));e(r,"stdin",require('@stdlib/streams-node-stdin/dist'));e(r,"stdout",require('@stdlib/streams-node-stdout/dist'));e(r,"transformStream",require('@stdlib/streams-node-transform/dist'));module.exports=r; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 0df7f0b..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\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\nvar setReadOnly = require( '@stdlib/utils-define-read-only-property' );\n\n\n// MAIN //\n\n/**\n* Top-level namespace.\n*\n* @namespace streams\n*/\nvar streams = {};\n\n/**\n* @name debugStream\n* @memberof streams\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/streams/node/debug}\n*/\nsetReadOnly( streams, 'debugStream', require( '@stdlib/streams-node-debug' ) );\n\n/**\n* @name debugSinkStream\n* @memberof streams\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/streams/node/debug-sink}\n*/\nsetReadOnly( streams, 'debugSinkStream', require( '@stdlib/streams-node-debug-sink' ) );\n\n/**\n* @name emptyStream\n* @memberof streams\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/streams/node/empty}\n*/\nsetReadOnly( streams, 'emptyStream', require( '@stdlib/streams-node-empty' ) );\n\n/**\n* @name arrayStream\n* @memberof streams\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/streams/node/from-array}\n*/\nsetReadOnly( streams, 'arrayStream', require( '@stdlib/streams-node-from-array' ) );\n\n/**\n* @name circularArrayStream\n* @memberof streams\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/streams/node/from-circular-array}\n*/\nsetReadOnly( streams, 'circularArrayStream', require( '@stdlib/streams-node-from-circular-array' ) );\n\n/**\n* @name constantStream\n* @memberof streams\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/streams/node/from-constant}\n*/\nsetReadOnly( streams, 'constantStream', require( '@stdlib/streams-node-from-constant' ) );\n\n/**\n* @name iteratorStream\n* @memberof streams\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/streams/node/from-iterator}\n*/\nsetReadOnly( streams, 'iteratorStream', require( '@stdlib/streams-node-from-iterator' ) );\n\n/**\n* @name stridedArrayStream\n* @memberof streams\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/streams/node/from-strided-array}\n*/\nsetReadOnly( streams, 'stridedArrayStream', require( '@stdlib/streams-node-from-strided-array' ) );\n\n/**\n* @name inspectStream\n* @memberof streams\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/streams/node/inspect}\n*/\nsetReadOnly( streams, 'inspectStream', require( '@stdlib/streams-node-inspect' ) );\n\n/**\n* @name inspectSinkStream\n* @memberof streams\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/streams/node/inspect-sink}\n*/\nsetReadOnly( streams, 'inspectSinkStream', require( '@stdlib/streams-node-inspect-sink' ) );\n\n/**\n* @name joinStream\n* @memberof streams\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/streams/node/join}\n*/\nsetReadOnly( streams, 'joinStream', require( '@stdlib/streams-node-join' ) );\n\n/**\n* @name splitStream\n* @memberof streams\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/streams/node/split}\n*/\nsetReadOnly( streams, 'splitStream', require( '@stdlib/streams-node-split' ) );\n\n/**\n* @name stderr\n* @memberof streams\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/streams/node/stderr}\n*/\nsetReadOnly( streams, 'stderr', require( '@stdlib/streams-node-stderr' ) );\n\n/**\n* @name stdin\n* @memberof streams\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/streams/node/stdin}\n*/\nsetReadOnly( streams, 'stdin', require( '@stdlib/streams-node-stdin' ) );\n\n/**\n* @name stdout\n* @memberof streams\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/streams/node/stdout}\n*/\nsetReadOnly( streams, 'stdout', require( '@stdlib/streams-node-stdout' ) );\n\n/**\n* @name transformStream\n* @memberof streams\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/streams/node/transform}\n*/\nsetReadOnly( streams, 'transformStream', require( '@stdlib/streams-node-transform' ) );\n\n\n// EXPORTS //\n\nmodule.exports = streams;\n"], - "mappings": "aA0BA,IAAIA,EAAc,QAAS,yCAA0C,EAUjEC,EAAU,CAAC,EASfD,EAAaC,EAAS,cAAe,QAAS,4BAA6B,CAAE,EAS7ED,EAAaC,EAAS,kBAAmB,QAAS,iCAAkC,CAAE,EAStFD,EAAaC,EAAS,cAAe,QAAS,4BAA6B,CAAE,EAS7ED,EAAaC,EAAS,cAAe,QAAS,iCAAkC,CAAE,EASlFD,EAAaC,EAAS,sBAAuB,QAAS,0CAA2C,CAAE,EASnGD,EAAaC,EAAS,iBAAkB,QAAS,oCAAqC,CAAE,EASxFD,EAAaC,EAAS,iBAAkB,QAAS,oCAAqC,CAAE,EASxFD,EAAaC,EAAS,qBAAsB,QAAS,yCAA0C,CAAE,EASjGD,EAAaC,EAAS,gBAAiB,QAAS,8BAA+B,CAAE,EASjFD,EAAaC,EAAS,oBAAqB,QAAS,mCAAoC,CAAE,EAS1FD,EAAaC,EAAS,aAAc,QAAS,2BAA4B,CAAE,EAS3ED,EAAaC,EAAS,cAAe,QAAS,4BAA6B,CAAE,EAS7ED,EAAaC,EAAS,SAAU,QAAS,6BAA8B,CAAE,EASzED,EAAaC,EAAS,QAAS,QAAS,4BAA6B,CAAE,EASvED,EAAaC,EAAS,SAAU,QAAS,6BAA8B,CAAE,EASzED,EAAaC,EAAS,kBAAmB,QAAS,gCAAiC,CAAE,EAKrF,OAAO,QAAUA", - "names": ["setReadOnly", "streams"] -} diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 1f072cb..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,965 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 debugStream = require( '@stdlib/streams-node-debug' ); -import debugSinkStream = require( '@stdlib/streams-node-debug-sink' ); -import emptyStream = require( '@stdlib/streams-node-empty' ); -import arrayStream = require( '@stdlib/streams-node-from-array' ); -import circularArrayStream = require( '@stdlib/streams-node-from-circular-array' ); -import constantStream = require( '@stdlib/streams-node-from-constant' ); -import iteratorStream = require( '@stdlib/streams-node-from-iterator' ); -import stridedArrayStream = require( '@stdlib/streams-node-from-strided-array' ); -import inspectStream = require( '@stdlib/streams-node-inspect' ); -import inspectSinkStream = require( '@stdlib/streams-node-inspect-sink' ); -import joinStream = require( '@stdlib/streams-node-join' ); -import splitStream = require( '@stdlib/streams-node-split' ); -import stderr = require( '@stdlib/streams-node-stderr' ); -import stdin = require( '@stdlib/streams-node-stdin' ); -import stdout = require( '@stdlib/streams-node-stdout' ); -import transformStream = require( '@stdlib/streams-node-transform' ); - -/** -* Interface describing the `node` namespace. -*/ -interface Namespace { - /** - * Returns a debug stream. - * - * @param options - stream options - * @throws must provide valid options - * @returns stream instance - * - * @example - * var DebugStream = ns.debugStream; - * var stream = new DebugStream({ - * 'name': 'my-stream' - * }); - * - * stream.write( 'a' ); - * stream.write( 'b' ); - * stream.write( 'c' ); - * stream.end(); - * - * @example - * var opts = { - * 'objectMode': true, - * 'highWaterMark': 64 - * }; - * - * var factory = ns.debugStream.factory( opts ); - * - * // Assign each stream to a separate debug namespace... - * var streams = []; - * var i; - * for ( i = 0; i < 10; i++ ) { - * streams.push( factory( 'stream '+i ) ); - * } - * - * @example - * var stream = ns.debugStream.objectMode(); - * - * stream.write( {'value': 'a'} ); - * stream.write( {'value': 'b'} ); - * stream.write( {'value': 'c'} ); - * stream.end(); - */ - debugStream: typeof debugStream; - - /** - * Returns an debug sink stream. - * - * @param options - stream options - * @throws must provide valid options - * @returns stream instance - * - * @example - * var DebugSinkStream = ns.debugSinkStream; - * var stream = new DebugSinkStream({ - * 'name': 'my-stream' - * }); - * - * stream.write( 'a' ); - * stream.write( 'b' ); - * stream.write( 'c' ); - * stream.end(); - * - * @example - * var opts = { - * 'objectMode': true, - * 'highWaterMark': 64 - * }; - * - * var factory = ns.debugSinkStream.factory( opts ); - * - * // Assign each stream to a separate debug namespace... - * var streams = []; - * var i; - * for ( i = 0; i < 10; i++ ) { - * streams.push( factory( 'stream '+i ) ); - * } - * @example - * var stream = ns.debugSinkStream.objectMode({ - * 'name': 'my-stream' - * }); - * - * stream.write( {'value': 'a'} ); - * stream.write( {'value': 'b'} ); - * stream.write( {'value': 'c'} ); - * stream.end(); - */ - debugSinkStream: typeof debugSinkStream; - - /** - * Returns an "empty" stream. - * - * @param options - stream options - * @throws must provide valid options - * @returns stream instance - * - * @example - * var inspectStream = require( '@stdlib/streams-node-inspect-sink' ); - * - * function log( chunk ) { - * console.log( chunk.toString() ); - * } - * - * var EmptyStream = ns.emptyStream; - * var stream = new EmptyStream(); - * - * stream.pipe( inspectStream( log ) ); - * - * @example - * var inspectStream = require( '@stdlib/streams-node-inspect-sink' ); - * - * function log( chunk ) { - * console.log( chunk.toString() ); - * } - * - * var stream = ns.emptyStream(); - * - * stream.pipe( inspectStream( log ) ); - * - * @example - * var opts = { - * 'objectMode': false - * }; - * - * var createStream = ns.emptyStream.factory( opts ); - * - * // Create 10 identically configured streams... - * var streams = []; - * var i; - * for ( i = 0; i < 10; i++ ) { - * streams.push( createStream() ); - * } - * - * @example - * var inspectStream = require( '@stdlib/streams-node-inspect-sink' ); - * - * function log( v ) { - * console.log( v ); - * } - * - * var stream = ns.emptyStream.objectMode(); - * - * stream.pipe( inspectStream.objectMode( log ) ); - */ - emptyStream: typeof emptyStream; - - /** - * Creates a readable stream from an array-like object. - * - * @param src - source array-like object - * @param options - stream options - * @throws must provide valid options - * @returns stream instance - * - * @example - * var inspectStream = require( '@stdlib/streams-node-inspect-sink' ); - * var Float64Array = require( '@stdlib/array-float64' ); - * var randu = require( '@stdlib/random-base-randu' ); - * - * function log( chunk ) { - * console.log( chunk.toString() ); - * } - * - * var arr = new Float64Array( 10 ); - * var i; - * for ( i = 0; i < arr.length; i++ ) { - * arr[ i ] = randu(); - * } - * - * var ArrayStream = ns.arrayStream; - * var stream = new ArrayStream( arr ); - * - * stream.pipe( inspectStream( log ) ); - * - * @example - * var Float64Array = require( '@stdlib/array-float64' ); - * var randu = require( '@stdlib/random-base-randu' ); - * - * var arr = new Float64Array( 10 ); - * var i; - * for ( i = 0; i < arr.length; i++ ) { - * arr[ i ] = randu(); - * } - * - * var opts = { - * 'sep': ',', - * 'objectMode': false, - * 'encoding': 'utf8', - * 'highWaterMark': 64 - * }; - * - * var createStream = ns.arrayStream.factory( opts ); - * - * // Create 10 identically configured streams... - * var streams = []; - * for ( i = 0; i < 10; i++ ) { - * streams.push( createStream( arr ) ); - * } - * - * @example - * var inspectStream = require( '@stdlib/streams-node-inspect-sink' ); - * var Float64Array = require( '@stdlib/array-float64' ); - * var randu = require( '@stdlib/random-base-randu' ); - * - * function log( v ) { - * console.log( v ); - * } - * - * var arr = new Float64Array( 10 ); - * var i; - * for ( i = 0; i < arr.length; i++ ) { - * arr[ i ] = randu(); - * } - * - * var stream = ns.arrayStream.objectMode( arr ); - * - * stream.pipe( inspectStream.objectMode( log ) ); - */ - arrayStream: typeof arrayStream; - - /** - * Creates a readable stream from an array-like object which repeatedly iterates over a provided value's elements. - * - * @param src - source array-like object - * @param options - stream options - * @throws must provide valid options - * @returns stream instance - * - * @example - * var inspectStream = require( '@stdlib/streams-node-inspect-sink' ); - * var Float64Array = require( '@stdlib/array-float64' ); - * var randu = require( '@stdlib/random-base-randu' ); - * - * function log( chunk ) { - * console.log( chunk.toString() ); - * } - * - * var arr = new Float64Array( 10 ); - * var i; - * for ( i = 0; i < arr.length; i++ ) { - * arr[ i ] = randu(); - * } - * - * var opts = { - * 'iter': arr.length * 2 - * }; - * - * var CircularArrayStream = ns.circularArrayStream; - * var stream = new CircularArrayStream( arr, opts ); - * - * stream.pipe( inspectStream( log ) ); - * - * @example - * var Float64Array = require( '@stdlib/array-float64' ); - * var randu = require( '@stdlib/random-base-randu' ); - * - * var arr = new Float64Array( 10 ); - * var i; - * for ( i = 0; i < arr.length; i++ ) { - * arr[ i ] = randu(); - * } - * - * var opts = { - * 'sep': ',', - * 'objectMode': false, - * 'encoding': 'utf8', - * 'highWaterMark': 64 - * }; - * - * var createStream = ns.circularArrayStream.factory( opts ); - * - * // Create 10 identically configured streams... - * var streams = []; - * for ( i = 0; i < 10; i++ ) { - * streams.push( createStream( arr ) ); - * } - * - * @example - * var inspectStream = require( '@stdlib/streams-node-inspect-sink' ); - * var Float64Array = require( '@stdlib/array-float64' ); - * var randu = require( '@stdlib/random-base-randu' ); - * - * function log( v ) { - * console.log( v ); - * } - * - * var arr = new Float64Array( 10 ); - * var i; - * for ( i = 0; i < arr.length; i++ ) { - * arr[ i ] = randu(); - * } - * - * var opts = { - * 'iter': arr.length * 2 - * }; - * - * var stream = ns.circularArrayStream.objectMode( arr, opts ); - * - * stream.pipe( inspectStream.objectMode( log ) ); - */ - circularArrayStream: typeof circularArrayStream; - - /** - * Returns a readable stream which always streams the same value. - * - * @param value - value to stream - * @param options - stream options - * @throws must provide valid options - * @returns stream instance - * - * @example - * var inspectStream = require( '@stdlib/streams-node-inspect-sink' ); - * - * function log( chunk ) { - * console.log( chunk.toString() ); - * } - * - * var opts = { - * 'iter': 10 - * }; - * - * var ConstantStream = ns.constantStream; - * var stream = new ConstantStream( 'beep', opts ); - * - * stream.pipe( inspectStream( log ) ); - * - * @example - * var opts = { - * 'sep': ',', - * 'objectMode': false, - * 'encoding': 'utf8', - * 'highWaterMark': 64 - * }; - * - * var createStream = ns.constantStream.factory( 'beep', opts ); - * - * // Create 10 identically configured streams... - * var streams = []; - * var i; - * for ( i = 0; i < 10; i++ ) { - * streams.push( createStream() ); - * } - * - * @example - * var inspectStream = require( '@stdlib/streams-node-inspect-sink' ); - * - * function log( v ) { - * console.log( v ); - * } - * - * var opts = { - * 'iter': 10 - * }; - * - * var stream = ns.constantStream.objectMode( 3.14, opts ); - * - * stream.pipe( inspectStream.objectMode( log ) ); - */ - constantStream: typeof constantStream; - - /** - * Creates a readable stream from an iterator. - * - * @param iterator - source iterator - * @param options - stream options - * @throws must provide valid options - * @returns stream instance - * - * @example - * var inspectStream = require( '@stdlib/streams-node-inspect-sink' ); - * var randu = require( '@stdlib/random-iter-randu' ); - * - * function log( chunk ) { - * console.log( chunk.toString() ); - * } - * - * var opts = { - * 'iter': 10 - * }; - * - * var IteratorStream = ns.iteratorStream; - * var stream = new IteratorStream( randu( opts ) ); - * - * stream.pipe( inspectStream( log ) ); - * - * @example - * var randu = require( '@stdlib/random-iter-randu' ); - * - * var opts = { - * 'sep': ',', - * 'objectMode': false, - * 'encoding': 'utf8', - * 'highWaterMark': 64 - * }; - * - * var createStream = ns.iteratorStream.factory( opts ); - * - * // Create 10 identically configured streams... - * var streams = []; - * var i; - * for ( i = 0; i < 10; i++ ) { - * streams.push( createStream( randu() ) ); - * } - * - * @example - * var randu = require( '@stdlib/random-iter-randu' ); - * var inspectStream = require( '@stdlib/streams-node-inspect-sink' ); - * - * function log( v ) { - * console.log( v ); - * } - * - * var opts = { - * 'iter': 10 - * }; - * - * var stream = ns.iteratorStream.objectMode( randu( opts ) ); - * - * stream.pipe( inspectStream.objectMode( log ) ); - */ - iteratorStream: typeof iteratorStream; - - /** - * Creates a readable stream from a strided array-like object. - * - * @param N - number of values to stream - * @param buffer - source value - * @param stride - stride length - * @param offset - starting index - * @param options - stream options - * @throws must provide valid options - * @returns stream instance - * - * @example - * var inspectStream = require( '@stdlib/streams-node-inspect-sink' ); - * var Float64Array = require( '@stdlib/array-float64' ); - * var randu = require( '@stdlib/random-base-randu' ); - * - * function log( chunk ) { - * console.log( chunk.toString() ); - * } - * - * var arr = new Float64Array( 10 ); - * var i; - * for ( i = 0; i < arr.length; i++ ) { - * arr[ i ] = randu(); - * } - * - * var StridedArrayStream = ns.stridedArrayStream; - * var stream = new StridedArrayStream( arr.length, arr, 1, 0 ); - * - * stream.pipe( inspectStream( log ) ); - * - * @example - * var Float64Array = require( '@stdlib/array-float64' ); - * var randu = require( '@stdlib/random-base-randu' ); - * - * var arr = new Float64Array( 10 ); - * var i; - * for ( i = 0; i < arr.length; i++ ) { - * arr[ i ] = randu(); - * } - * - * var opts = { - * 'sep': ',', - * 'objectMode': false, - * 'encoding': 'utf8', - * 'highWaterMark': 64 - * }; - * - * var createStream = ns.stridedArrayStream.factory( opts ); - * - * // Create 10 identically configured streams... - * var streams = []; - * for ( i = 0; i < 10; i++ ) { - * streams.push( createStream( arr.length, arr, 1, 0 ) ); - * } - * - * @example - * var inspectStream = require( '@stdlib/streams-node-inspect-sink' ); - * var Float64Array = require( '@stdlib/array-float64' ); - * var randu = require( '@stdlib/random-base-randu' ); - * - * function log( v ) { - * console.log( v ); - * } - * - * var arr = new Float64Array( 10 ); - * var i; - * for ( i = 0; i < arr.length; i++ ) { - * arr[ i ] = randu(); - * } - * - * var stream = ns.stridedArrayStream.objectMode( arr.length, arr, 1, 0 ); - * - * stream.pipe( inspectStream.objectMode( log ) ); - */ - stridedArrayStream: typeof stridedArrayStream; - - /** - * Returns an inspect stream. - * - * @param options - stream options - * @throws must provide valid options - * @returns stream instance - * - * @example - * function log( chunk, idx ) { - * console.log( 'index: %d', idx ); - * console.log( chunk ); - * } - * - * var InspectStream = ns.inspectStream; - * var stream = new InspectStream( {}, log ); - * - * stream.write( 'a' ); - * stream.write( 'b' ); - * stream.write( 'c' ); - * - * stream.end(); - * - * // prints: index: 0 - * // prints: a - * // prints: index: 1 - * // prints: b - * // prints: index: 2 - * // prints: c - * - * @example - * function log( chunk, idx ) { - * console.log( 'index: %d', idx ); - * console.log( chunk ); - * } - * - * var opts = { - * 'objectMode': true, - * 'highWaterMark': 64 - * }; - * - * var factory = ns.inspectStream.factory( opts ); - * - * // Create 10 identically configured streams... - * var streams = []; - * var i; - * for ( i = 0; i < 10; i++ ) { - * streams.push( factory( log ) ); - * } - * - * @example - * function log( chunk, idx ) { - * console.log( 'index: %d', idx ); - * console.log( chunk ); - * } - * - * var opts = { - * 'objectMode': true, - * 'highWaterMark': 64 - * }; - * - * var factory = ns.inspectStream.factory( opts ); - * - * // Create 10 identically configured streams... - * var streams = []; - * var i; - * for ( i = 0; i < 10; i++ ) { - * streams.push( factory( log ) ); - * } - * - * @example - * function log( chunk, idx ) { - * console.log( 'index: %d', idx ); - * console.log( chunk ); - * } - * - * var stream = ns.inspectStream.objectMode( {}, log ); - * - * stream.write( {'value': 'a'} ); - * stream.write( {'value': 'b'} ); - * stream.write( {'value': 'c'} ); - * - * stream.end(); - * - * // prints: index: 0 - * // prints: {'value': 'a'} - * // prints: index: 1 - * // prints: {'value': 'b'} - * // prints: index: 2 - * // prints: {'value': 'c'} - */ - inspectStream: typeof inspectStream; - - /** - * Returns an inspect sink stream. - * - * @param options - stream options - * @throws must provide valid options - * @returns stream instance - * - * @example - * function log( chunk, idx ) { - * console.log( 'index: %d', idx ); - * console.log( chunk ); - * } - * - * var InspectSinkStream = ns.inspectSinkStream; - * var stream = new InspectSinkStream( {}, log ); - * - * stream.write( 'a' ); - * stream.write( 'b' ); - * stream.write( 'c' ); - * - * stream.end(); - * - * // prints: index: 0 - * // prints: a - * // prints: index: 1 - * // prints: b - * // prints: index: 2 - * // prints: c - * - * @example - * function log( chunk, idx ) { - * console.log( 'index: %d', idx ); - * console.log( chunk ); - * } - * - * var opts = { - * 'objectMode': true, - * 'highWaterMark': 64 - * }; - * - * var factory = ns.inspectSinkStream.factory( opts ); - * - * // Create 10 identically configured streams... - * var streams = []; - * var i; - * for ( i = 0; i < 10; i++ ) { - * streams.push( factory( log ) ); - * } - * - * @example - * function log( chunk, idx ) { - * console.log( 'index: %d', idx ); - * console.log( chunk ); - * } - * - * var stream = ns.inspectSinkStream.objectMode( {}, log ); - * - * stream.write( {'value': 'a'} ); - * stream.write( {'value': 'b'} ); - * stream.write( {'value': 'c'} ); - * - * stream.end(); - * - * // prints: 'index: 0' - * // prints: {'value': 'a'} - * // prints: 'index: 1' - * // prints: {'value': 'b'} - * // prints: 'index: 2' - * // prints: {'value': 'c'} - */ - inspectSinkStream: typeof inspectSinkStream; - - /** - * Returns a join stream. - * - * @param options - stream options - * @throws must provide valid options - * @returns stream instance - * - * @example - * var inspectStream = require( '@stdlib/streams-node-inspect-sink' ); - * - * function log( chunk ) { - * console.log( chunk ); - * } - * - * var JoinStream = ns.joinStream; - * var stream = new JoinStream(); - * - * stream.pipe( inspectStream( log ) ); - * - * stream.write( '1' ); - * stream.write( '2' ); - * stream.write( '3' ); - * - * stream.end(); - * - * // prints: '1\n2\n3' - * - * @example - * var inspectStream = require( '@stdlib/streams-node-inspect-sink' ); - * - * function log( chunk ) { - * console.log( chunk ); - * } - * - * var stream = ns.joinStream(); - * - * stream.pipe( inspectStream( log ) ); - * - * stream.write( '1' ); - * stream.write( '2' ); - * stream.write( '3' ); - * - * stream.end(); - * - * // prints: '1\n2\n3'; - * - * @example - * var opts = { - * 'sep': '\t', - * 'objectMode': true, - * 'encoding': 'utf8', - * 'highWaterMark': 64 - * }; - * - * var factory = ns.joinStream.factory( opts ); - * - * // Create 10 identically configured streams... - * var streams = []; - * var i; - * for ( i = 0; i < 10; i++ ) { - * streams.push( factory() ); - * } - * - * @example - * var inspectStream = require( '@stdlib/streams-node-inspect-sink' ); - * - * function log( chunk ) { - * console.log( chunk.toString() ); - * } - * - * var stream = ns.joinStream.objectMode({ - * 'sep': ',' - * }); - * - * stream.pipe( inspectStream( log ) ); - * - * stream.write( 'a' ); - * stream.write( 'b' ); - * stream.write( 'c' ); - * - * stream.end(); - * - * // prints: 'a,b,c' - */ - joinStream: typeof joinStream; - - /** - * Returns a split stream. - * - * @param options - stream options - * @throws must provide valid options - * @returns stream instance - * - * @example - * var SplitStream = ns.splitStream; - * var stream = new SplitStream(); - * - * stream.write( '1\n2\n3' ); - * stream.end(); - * - * @example - * var stream = ns.splitStream(); - * - * stream.write( '1\n2\n3' ); - * stream.end(); - * - * @example - * var opts = { - * 'sep': '\t', - * 'objectMode': true, - * 'encoding': 'utf8' - * }; - * - * var factory = ns.splitStream.factory( opts ); - * - * // Create 10 identically configured streams... - * var streams = []; - * var i; - * for ( i = 0; i < 10; i++ ) { - * streams.push( factory() ); - * } - * - * @example - * var stream = ns.splitStream.objectMode({ - * 'sep': ',' - * }); - * - * stream.write( 'a,b,c' ); - * stream.end(); - */ - splitStream: typeof splitStream; - - /** - * Standard error. - */ - stderr: typeof stderr; - - /** - * Standard input. - */ - stdin: typeof stdin; - - /** - * Standard output. - */ - stdout: typeof stdout; - - /** - * Returns a transform stream. - * - * @param options - stream options - * @throws must provide valid options - * @returns stream instance - * - * @example - * var stdout = require( '@stdlib/streams-node-stdout' ); - * - * function transform( chunk, enc, clbk ) { - * clbk( null, chunk.toString()+'\n' ); - * } - * - * var opts = { - * 'transform': transform - * }; - * var TransformStream = ns.transformStream; - * var stream = new TransformStream( opts ); - * - * stream.pipe( stdout ); - * - * stream.write( '1' ); - * stream.write( '2' ); - * stream.write( '3' ); - * - * stream.end(); - * - * // prints: '1\n2\n3\n' - * - * @example - * var stdout = require( '@stdlib/streams-node-stdout' ); - * - * function transform( chunk, enc, clbk ) { - * clbk( null, chunk.toString()+'\n' ); - * } - * - * var opts = { - * 'transform': transform - * }; - * var stream = ns.transformStream( opts ); - * - * stream.pipe( stdout ); - * - * stream.write( '1' ); - * stream.write( '2' ); - * stream.write( '3' ); - * - * stream.end(); - * - * // prints: '1\n2\n3\n' - * - * @example - * function transform( chunk, enc, clbk ) { - * clbk( null, chunk.toString()+'\n' ); - * } - * - * var opts = { - * 'objectMode': true, - * 'encoding': 'utf8', - * 'highWaterMark': 64, - * 'decodeStrings': false - * }; - * - * var factory = ns.transformStream.factory( opts ); - * - * // Create 10 identically configured streams... - * var streams = []; - * var i; - * for ( i = 0; i < 10; i++ ) { - * streams.push( factory( transform ) ); - * } - * - * @example - * var stdout = require( '@stdlib/streams-node-stdout' ); - * - * function stringify( chunk, enc, clbk ) { - * clbk( null, JSON.stringify( chunk ) ); - * } - * - * function newline( chunk, enc, clbk ) { - * clbk( null, chunk+'\n' ); - * } - * - * var s1 = ns.transformStream.objectMode({ - * 'transform': stringify - * }); - * - * var s2 = ns.transformStream.objectMode({ - * 'transform': newline - * }); - * - * s1.pipe( s2 ).pipe( stdout ); - * - * s1.write( {'value': 'a'} ); - * s1.write( {'value': 'b'} ); - * s1.write( {'value': 'c'} ); - * - * s1.end(); - * - * // prints: '{"value":"a"}\n{"value":"b"}\n{"value":"c"}\n' - */ - transformStream: typeof transformStream; -} - -/** -* Node.js streams. -*/ -declare var ns: Namespace; - - -// EXPORTS // - -export = ns; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index c2dd14e..0000000 --- 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/examples/index.js b/examples/index.js deleted file mode 100644 index 73dd12f..0000000 --- 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 streams = require( './../lib' ); - -console.log( objectKeys( streams ) ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..1388d49 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("stream"),require("process"),require("buffer")):"function"==typeof define&&define.amd?define(["stream","process","buffer"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).streams=t(e.require$$0$2,e.require$$0$1,e.require$$0$3)}(this,(function(e,t,r){"use strict";var n="function"==typeof Object.defineProperty?Object.defineProperty:null;var i=Object.defineProperty;function o(e){return"number"==typeof e}function a(e){var t,r="";for(t=0;t0&&(t-=1),r=n.toExponential(t)):r=n.toPrecision(e.precision),e.alternate||(r=h.call(r,j,"$1e"),r=h.call(r,v,"e"),r=h.call(r,w,""));break;default:throw new Error("invalid double notation. Value: "+e.specifier)}return r=h.call(r,g,"e+0$1"),r=h.call(r,b,"e-0$1"),e.alternate&&(r=h.call(r,m,"$1."),r=h.call(r,y,"$1.e")),n>=0&&e.sign&&(r=e.sign+r),r=e.specifier===p.call(e.specifier)?p.call(r):f.call(r)}function _(e){var t,r="";for(t=0;t127)throw new Error("invalid character code. Value: "+n.arg);n.arg=T(o)?String(n.arg):M(o)}break;case"e":case"E":case"f":case"F":case"g":case"G":t||(n.precision=6),n.arg=O(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=s(n.arg,n.width||n.precision,n.padRight):n.width&&(n.arg=(f=n.arg,p=n.width,h=n.padRight,g=void 0,(g=p-f.length)<0?f:f=h?f+_(g):_(g)+f)),a+=n.arg||"",u+=1}return a}var V=/%(?:([1-9]\d*)\$)?([0 +\-#]*)(\*|\d+)?(?:(\.)(\*|\d+)?)?[hlL]?([%A-Za-z])/g;function x(e){var t={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]&&(t.precision="1"),t}function W(e){var t,r,n,i;for(r=[],i=0,n=V.exec(e);n;)(t=e.slice(i,V.lastIndex-n[0].length)).length&&r.push(t),r.push(x(n)),i=V.lastIndex,n=V.exec(e);return(t=e.slice(i)).length&&r.push(t),r}function C(e){var t,r;if("string"!=typeof e)throw new TypeError(C("invalid argument. First argument must be a string. Value: `%s`.",e));for(t=[W(e)],r=1;rqe&&Xe(e)}function Ye(e){return Ae(e)&&Ze(e)}function De(e){return Fe(e)&&Ze(e.valueOf())}function Ke(e){return Ye(e)||De(e)}B(Ke,"isPrimitive",Ye),B(Ke,"isObject",De);var Qe=Object.prototype.propertyIsEnumerable;var et=!Qe.call("beep","0");function tt(e,t){var r;return null!=e&&(!(r=Qe.call(e,t))&&et&&Ne(e)?!Be(t=+t)&&Ye(t)&&t>=0&&t=0&&e.length<=4294967295&&Y(e,"callee")&&!tt(e,"callee")};var nt=rt,it=Array.prototype.slice;var ot=tt((function(){}),"prototype"),at=!tt({toString:null},"toString"),st=9007199254740991;function ut(e){return"object"==typeof e&&null!==e&&"number"==typeof e.length&&Xe(e.length)&&e.length>=0&&e.length<=st}function lt(e,t,r){var n,i;if(!ut(e)&&!xe(e))throw new TypeError(C("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(!Ye(r))throw new TypeError(C("invalid argument. Third argument must be an integer. Value: `%s`.",r));if(r>=0){if(r>=n)return-1;i=r}else(i=n+r)<0&&(i=0)}else i=0;if($e(t)){for(;i0&&!Y(e,"0"))for(s=0;s=0}function Bt(e){return Fe(e)&&e.valueOf()>=0}function Lt(e){return Pt(e)||Bt(e)}B(Lt,"isPrimitive",Pt),B(Lt,"isObject",Bt);var $t=L(Object.freeze({__proto__:null,default:()=>()=>{}})),Ut=$t("inspect-stream"),qt=e.Transform;function Gt(e,t){var r,n,i;if(!(this instanceof Gt))return arguments.length>1?new Gt(e,t):new Gt(e);if(n=Et({},Nt),arguments.length>1){if(r=t,i=function(e,t){return Rt(t)?Y(t,"objectMode")&&(e.objectMode=t.objectMode,!U(e.objectMode))?new TypeError(C("invalid option. `%s` option must be a boolean. Option: `%s`.","objectMode",e.objectMode)):Y(t,"readableObjectMode")&&(e.readableObjectMode=t.readableObjectMode,!U(e.readableObjectMode))?new TypeError(C("invalid option. `%s` option must be a boolean. Option: `%s`.","readableObjectMode",e.readableObjectMode)):Y(t,"allowHalfOpen")&&(e.allowHalfOpen=t.allowHalfOpen,!U(e.allowHalfOpen))?new TypeError(C("invalid option. `%s` option must be a boolean. Option: `%s`.","allowHalfOpen",e.allowHalfOpen)):Y(t,"highWaterMark")&&(e.highWaterMark=t.highWaterMark,!Pt(e.highWaterMark))?new TypeError(C("invalid option. `%s` option must be a nonnegative number. Option: `%s`.","highWaterMark",e.highWaterMark)):null:new TypeError(C("invalid argument. Options argument must be an object. Value: `%s`.",t))}(n,e),i)throw i}else r=e;if(!Oe(r))throw new TypeError(C("invalid argument. Callback argument must be a function. Value: `%s`.",r));return n.writableObjectMode=!0,Ut("Creating a transform stream configured with the following options: %s.",JSON.stringify(n)),qt.call(this,n),Wt(this,"_destroyed",!1),Wt(this,"_idx",-1),B(this,"_inspect",r),this}xt(Gt,qt),B(Gt.prototype,"_transform",(function(e,t,r){this._idx+=1,Ut("Received a new chunk. Chunk: %s. Encoding: %s. Index: %d.",e.toString(),t,this._idx),this._inspect.call(null,e,this._idx),this.push(e),r()})),B(Gt.prototype,"_flush",(function(e){Ut("Flushing the stream..."),e()})),B(Gt.prototype,"destroy",(function(e){var t;return this._destroyed?(Ut("Attempted to destroy an already destroyed stream."),this):(t=this,this._destroyed=!0,It((function(){e&&(Ut("Stream was destroyed due to an error. Error: %s.",JSON.stringify(e)),t.emit("error",e));Ut("Closing the stream..."),t.emit("close")})),this)})),B(Gt,"objectMode",(function(e,t){var r,n;if(arguments.length>1){if(!Rt(e))throw new TypeError(C("invalid argument. Options argument must be an object. Value: `%s`.",e));r=Et({},e),n=t}else r={},n=e;return r.objectMode=!0,new Gt(r,n)})),B(Gt,"factory",(function(e){var t;if(arguments.length){if(!Rt(e))throw new TypeError(C("invalid argument. Options argument must be an object. Value: `%s`.",e));t=Et({},e)}else t={};return function(e){return new Gt(t,e)}}));var Xt="debug-stream",Zt=$t(Xt),Yt={objectMode:!1,allowHalfOpen:!1,readableObjectMode:!1,name:""};function Dt(e,t){return Rt(t)?Y(t,"name")&&(e.name=t.name,!xe(e.name))?new TypeError(C("invalid option. `%s` option must be a string. Option: `%s`.","name",e.name)):Y(t,"objectMode")&&(e.objectMode=t.objectMode,!U(e.objectMode))?new TypeError(C("invalid option. `%s` option must be a boolean. Option: `%s`.","objectMode",e.objectMode)):Y(t,"readableObjectMode")&&(e.readableObjectMode=t.readableObjectMode,!U(e.readableObjectMode))?new TypeError(C("invalid option. `%s` option must be a boolean. Option: `%s`.","readableObjectMode",e.readableObjectMode)):Y(t,"allowHalfOpen")&&(e.allowHalfOpen=t.allowHalfOpen,!U(e.allowHalfOpen))?new TypeError(C("invalid option. `%s` option must be a boolean. Option: `%s`.","allowHalfOpen",e.allowHalfOpen)):Y(t,"highWaterMark")&&(e.highWaterMark=t.highWaterMark,!Pt(e.highWaterMark))?new TypeError(C("invalid option. `%s` option must be a nonnegative number. Option: `%s`.","highWaterMark",e.highWaterMark)):null:new TypeError(C("invalid argument. Options argument must be an object. Value: `%s`.",t))}var Kt=$t;function Qt(e,t){var r,n,i,o,a;if(!(this instanceof Qt))return arguments.length>1?new Qt(e,t):1===arguments.length?new Qt(e):new Qt;if(r=Et({},Yt),arguments.length>1){if(!Oe(t))throw new TypeError(C("invalid argument. Callback argument must be a function. Value: `%s`.",t));a=t,o=Dt(r,e)}else arguments.length&&(Oe(e)?a=e:o=Dt(r,e));if(o)throw o;return n=r.name?Xt+":"+r.name:Xt,i=Kt(n),Zt("Creating a transform stream configured with the following options: %s.",JSON.stringify(r)),Gt.call(this,r,(function(e,t){if(a)return Zt("Received a new chunk. Chunk: %s. Index: %d.",e.toString(),t),a(i,e,t);we(e)&&(e=e.toString());e=JSON.stringify(e),Zt("Received a new chunk. Chunk: %s. Index: %d.",e,t),i("Chunk: %s. Index: %d.",e,t)})),this}xt(Qt,Gt),B(Qt,"objectMode",(function(e,t){var r,n;if(arguments.length>1){if(!Rt(e))throw new TypeError(C("invalid argument. Options argument must be an object. Value: `%s`.",e));if(r=Et({},e),n=t,!Oe(t))throw new TypeError(C("invalid argument. Callback argument must be a function. Value: `%s`.",t))}else if(arguments.length)if(Oe(e))r={},n=e;else{if(!Rt(e))throw new TypeError(C("invalid argument. Options argument must be an object. Value: `%s`.",e));r=Et({},e)}else r={};return r.objectMode=!0,void 0===n?new Qt(r):new Qt(r,n)})),B(Qt,"factory",(function(e){var t;if(arguments.length){if(!Rt(e))throw new TypeError(C("invalid argument. Options argument must be an object. Value: `%s`.",e));t=Et({},e)}else t={};return function(e,r){if(t.name=e,arguments.length>1)return new Qt(t,r);return new Qt(t)}}));var er={objectMode:!1,decodeStrings:!0,defaultEncoding:"utf8"};var tr=$t("inspect-stream-sink"),rr=e.Writable;function nr(e,t){var r,n,i;if(!(this instanceof nr))return arguments.length>1?new nr(e,t):new nr(e);if(n=Et({},er),arguments.length>1){if(r=t,i=function(e,t){return Rt(t)?Y(t,"objectMode")&&(e.objectMode=t.objectMode,!U(e.objectMode))?new TypeError(C("invalid option. `%s` option must be a boolean. Option: `%s`.","objectMode",e.objectMode)):Y(t,"highWaterMark")&&(e.highWaterMark=t.highWaterMark,!Pt(e.highWaterMark))?new TypeError(C("invalid option. `%s` option must be a nonnegative number. Option: `%s`.","highWaterMark",e.highWaterMark)):Y(t,"decodeStrings")&&(e.decodeStrings=t.decodeStrings,!U(e.decodeStrings))?new TypeError(C("invalid option. `%s` option must be a boolean. Option: `%s`.","decodeStrings",e.decodeStrings)):Y(t,"defaultEncoding")&&(e.defaultEncoding=t.defaultEncoding,!xe(e.defaultEncoding))?new TypeError(C("invalid option. `%s` option must be a string. Option: `%s`.","defaultEncoding",e.defaultEncoding)):null:new TypeError(C("invalid argument. Options argument must be an object. Value: `%s`.",t))}(n,e),i)throw i}else r=e;if(!Oe(r))throw new TypeError(C("invalid argument. Callback argument must be a function. Value: `%s`.",r));return tr("Creating a writable stream configured with the following options: %s.",JSON.stringify(n)),rr.call(this,n),Wt(this,"_destroyed",!1),Wt(this,"_idx",-1),B(this,"_inspect",r),this}xt(nr,rr),B(nr.prototype,"_write",(function(e,t,r){if(this._idx+=1,tr("Received a new chunk. Chunk: %s. Encoding: %s. Index: %d.",e.toString(),t,this._idx),this._inspect.call(null,e,this._idx),this._destroyed)return It(r);r()})),B(nr.prototype,"destroy",(function(e){var t;return this._destroyed?(tr("Attempted to destroy an already destroyed stream."),this):(t=this,this._destroyed=!0,It((function(){e&&(tr("Stream was destroyed due to an error. Error: %s.",JSON.stringify(e)),t.emit("error",e));tr("Closing the stream..."),t.emit("close")})),this)})),B(nr,"objectMode",(function(e,t){var r,n;if(arguments.length>1){if(!Rt(e))throw new TypeError(C("invalid argument. Options argument must be an object. Value: `%s`.",e));r=Et({},e),n=t}else r={},n=e;return r.objectMode=!0,new nr(r,n)})),B(nr,"factory",(function(e){var t;if(arguments.length){if(!Rt(e))throw new TypeError(C("invalid argument. Options argument must be an object. Value: `%s`.",e));t=Et({},e)}else t={};return function(e){return new nr(t,e)}}));var ir="debug-stream-sink",or=$t(ir),ar={objectMode:!1,decodeStrings:!0,defaultEncoding:"utf8",name:""};function sr(e,t){return Rt(t)?Y(t,"name")&&(e.name=t.name,!xe(e.name))?new TypeError(C("invalid option. `%s` option must be a string. Option: `%s`.","name",e.name)):Y(t,"objectMode")&&(e.objectMode=t.objectMode,!U(e.objectMode))?new TypeError(C("invalid option. `%s` option must be a boolean. Option: `%s`.","objectMode",e.objectMode)):Y(t,"highWaterMark")&&(e.highWaterMark=t.highWaterMark,!Pt(e.highWaterMark))?new TypeError(C("invalid option. `%s` option must be a nonnegative number. Option: `%s`.","highWaterMark",e.highWaterMark)):Y(t,"decodeStrings")&&(e.decodeStrings=t.decodeStrings,!U(e.decodeStrings))?new TypeError(C("invalid option. `%s` option must be a boolean. Option: `%s`.","decodeStrings",e.decodeStrings)):Y(t,"defaultEncoding")&&(e.defaultEncoding=t.defaultEncoding,!xe(e.defaultEncoding))?new TypeError(C("invalid option. `%s` option must be a string. Option: `%s`.","defaultEncoding",e.defaultEncoding)):null:new TypeError(C("invalid argument. Options argument must be an object. Value: `%s`.",t))}var ur=$t;function lr(e,t){var r,n,i,o,a;if(!(this instanceof lr))return arguments.length>1?new lr(e,t):1===arguments.length?new lr(e):new lr;if(r=Et({},ar),arguments.length>1){if(!Oe(t))throw new TypeError(C("invalid argument. Callback argument must be a function. Value: `%s`.",t));a=t,o=sr(r,e)}else arguments.length&&(Oe(e)?a=e:o=sr(r,e));if(o)throw o;return n=r.name?ir+":"+r.name:ir,i=ur(n),or("Creating a writable stream configured with the following options: %s.",JSON.stringify(r)),nr.call(this,r,(function(e,t){if(a)return or("Received a new chunk. Chunk: %s. Index: %d.",e.toString(),t),a(i,e,t);we(e)&&(e=e.toString());e=JSON.stringify(e),or("Received a new chunk. Chunk: %s. Index: %d.",e,t),i("Chunk: %s. Index: %d.",e,t)})),this}function cr(e){if("object"!=typeof e||null===e)return!1;if(e instanceof Error)return!0;for(;e;){if("[object Error]"===Q(e))return!0;e=Jt(e)}return!1}xt(lr,nr),B(lr,"objectMode",(function(e,t){var r,n;if(arguments.length>1){if(!Rt(e))throw new TypeError(C("invalid argument. Options argument must be an object. Value: `%s`.",e));if(r=Et({},e),n=t,!Oe(t))throw new TypeError(C("invalid argument. Callback argument must be a function. Value: `%s`.",t))}else if(arguments.length)if(Oe(e))r={},n=e;else{if(!Rt(e))throw new TypeError(C("invalid argument. Options argument must be an object. Value: `%s`.",e));r=Et({},e)}else r={};return r.objectMode=!0,void 0===n?new lr(r):new lr(r,n)})),B(lr,"factory",(function(e){var t;if(arguments.length){if(!Rt(e))throw new TypeError(C("invalid argument. Options argument must be an object. Value: `%s`.",e));t=Et({},e)}else t={};return function(e,r){if(t.name=e,arguments.length>1)return new lr(t,r);return new lr(t)}}));var dr={objectMode:!1};var fr=$t("empty-stream"),pr=e.Readable;function hr(e){var t,r;if(!(this instanceof hr))return arguments.length>0?new hr(e):new hr;if(t=Et({},dr),arguments.length>0&&(r=function(e,t){return Rt(t)?Y(t,"objectMode")&&(e.objectMode=t.objectMode,!U(e.objectMode))?new TypeError(C("invalid option. `%s` option must be a boolean. Option: `%s`.","objectMode",e.objectMode)):null:new TypeError(C("invalid argument. Options argument must be an object. Value: `%s`.",t))}(t,e),r))throw r;return fr("Creating a readable stream configured with the following options: %s.",JSON.stringify(t)),pr.call(this,t),Wt(this,"_destroyed",!1),this}xt(hr,pr),B(hr.prototype,"_read",(function(){this.push(null)})),B(hr.prototype,"destroy",(function(e){var t;return this._destroyed?(fr("Attempted to destroy an already destroyed stream."),this):(t=this,this._destroyed=!0,It((function(){e&&(fr("Stream was destroyed due to an error. Error: %s.",cr(e)?e.message:JSON.stringify(e)),t.emit("error",e));fr("Closing the stream..."),t.emit("close")})),this)})),B(hr,"objectMode",(function(){return new hr({objectMode:!0})})),B(hr,"factory",(function(e){var t;if(arguments.length>0){if(!Rt(e))throw new TypeError(C("invalid argument. Options argument must be an object. Value: `%s`.",e));t=Et({},e)}else t={};return function(){return new hr(t)}}));var gr="function"==typeof Buffer?Buffer:null;var br,mr=r.Buffer;br=function(){var e,t;if("function"!=typeof gr)return!1;try{e=we(t="function"==typeof gr.from?gr.from([1,2,3,4]):new gr([1,2,3,4]))&&1===t[0]&&2===t[1]&&3===t[2]&&4===t[3]}catch(t){e=!1}return e}()?mr:function(){throw new Error("not implemented")};var yr,wr=br;yr=Oe(wr.from)?function(e,t){if(!xe(e))throw new TypeError(C("invalid argument. First argument must be a string. Value: `%s`.",e));if(arguments.length>1){if(!xe(t))throw new TypeError(C("invalid argument. Second argument must be a string. Value: `%s`.",t));return wr.from(e,t)}return wr.from(e,"utf8")}:function(e,t){if(!xe(e))throw new TypeError(C("invalid argument. First argument must be a string. Value: `%s`.",e));if(arguments.length>1){if(!xe(t))throw new TypeError(C("invalid argument. Second argument must be a string. Value: `%s`.",t));return new wr(e,t)}return new wr(e,"utf8")};var vr=yr,jr={objectMode:!1,encoding:null,sep:"\n",dir:1};var Or=$t("from-array-stream"),_r=e.Readable;function Mr(e,t){var r,n;if(!(this instanceof Mr))return arguments.length>1?new Mr(e,t):new Mr(e);if(!ut(e))throw new TypeError(C("invalid argument. First argument must be an array-like object. Value: `%s`.",e));if(r=Et({},jr),arguments.length>1&&(n=function(e,t){return Rt(t)?Y(t,"sep")&&(e.sep=t.sep,!xe(e.sep))?new TypeError(C("invalid option. `%s` option must be a string. Option: `%s`.","sep",e.sep)):Y(t,"objectMode")&&(e.objectMode=t.objectMode,!U(e.objectMode))?new TypeError(C("invalid option. `%s` option must be a boolean. Option: `%s`.","objectMode",e.objectMode)):Y(t,"encoding")&&(e.encoding=t.encoding,!xe(e.encoding)&&null!==e.encoding)?new TypeError(C("invalid option. `%s` option must be a string or null. Option: `%s`.","encoding",e.encoding)):Y(t,"highWaterMark")&&(e.highWaterMark=t.highWaterMark,!Pt(e.highWaterMark))?new TypeError(C("invalid option. `%s` option must be a nonnegative number. Option: `%s`.","highWaterMark",e.highWaterMark)):Y(t,"serialize")&&(e.serialize=t.serialize,!Oe(e.serialize))?new TypeError(C("invalid option. `%s` option must be a function. Option: `%s`.","serialize",e.serialize)):Y(t,"dir")&&(e.dir=t.dir,1!==e.dir&&-1!==e.dir)?new TypeError(C("invalid option. `%s` option must be either `1` or `-1`. Option: `%s`.","dir",e.dir)):null:new TypeError(C("invalid argument. Options argument must be an object. Value: `%s`.",t))}(r,t),n))throw n;return Or("Creating a readable stream configured with the following options: %s.",JSON.stringify(r)),_r.call(this,r),Wt(this,"_destroyed",!1),B(this,"_objectMode",r.objectMode),B(this,"_sep",r.sep),B(this,"_serialize",r.serialize||JSON.stringify),B(this,"_src",e),B(this,"_stride",r.dir),Wt(this,"_i",0),Wt(this,"_idx",1===r.dir?0:e.length-1),this}xt(Mr,_r),B(Mr.prototype,"_read",(function(){var e,t,r;if(!this._destroyed)for(e=!0;e;){if(t=null,this._i+=1,this._i>this._src.length)return Or("Finished iteration."),this.push(null);r=this._src[this._idx],Or("Value: %s. Idx: %d. Iter: %d.",JSON.stringify(r),this._idx,this._i),this._idx+=this._stride,!1===this._objectMode&&("string"==typeof(r=this._serialize(r))?r=1===this._i?vr(r):vr(this._sep+r):we(r)?this._i>1&&(r=wr.concat([vr(this._sep),r])):t=new Error(C("invalid operation. Serialization function must return a string or Buffer. Value: `%s`.",r))),t?this.emit("error",t):e=this.push(r)}})),B(Mr.prototype,"destroy",(function(e){var t;return this._destroyed?(Or("Attempted to destroy an already destroyed stream."),this):(t=this,this._destroyed=!0,It((function(){e&&(Or("Stream was destroyed due to an error. Error: %s.",cr(e)?e.message:JSON.stringify(e)),t.emit("error",e));Or("Closing the stream..."),t.emit("close")})),this)})),B(Mr,"objectMode",(function(e,t){var r;if(arguments.length>1){if(!Rt(r=t))throw new TypeError(C("invalid argument. Options argument must be an object. Value: `%s`.",r));r=Et({},t)}else r={};return r.objectMode=!0,new Mr(e,r)})),B(Mr,"factory",(function(e){var t;if(arguments.length){if(!Rt(e))throw new TypeError(C("invalid argument. Options argument must be an object. Value: `%s`.",e));t=Et({},e)}else t={};return function(e){return new Mr(e,t)}}));var Er={objectMode:!1,encoding:null,sep:"\n",iter:1e308,dir:1};function Tr(e){return Ye(e)&&e>=0}function Sr(e){return De(e)&&e.valueOf()>=0}function kr(e){return Tr(e)||Sr(e)}B(kr,"isPrimitive",Tr),B(kr,"isObject",Sr);var Vr=$t("from-circular-array-stream"),xr=e.Readable;function Wr(e,t){var r,n;if(!(this instanceof Wr))return arguments.length>1?new Wr(e,t):new Wr(e);if(!ut(e))throw new TypeError(C("invalid argument. First argument must be an array-like object. Value: `%s`.",e));if(r=Et({},Er),arguments.length>1&&(n=function(e,t){return Rt(t)?Y(t,"sep")&&(e.sep=t.sep,!xe(e.sep))?new TypeError(C("invalid option. `%s` option must be a string. Option: `%s`.","sep",e.sep)):Y(t,"objectMode")&&(e.objectMode=t.objectMode,!U(e.objectMode))?new TypeError(C("invalid option. `%s` option must be a boolean. Option: `%s`.","objectMode",e.objectMode)):Y(t,"encoding")&&(e.encoding=t.encoding,!xe(e.encoding)&&null!==e.encoding)?new TypeError(C("invalid option. `%s` option must be a string or null. Option: `%s`.","encoding",e.encoding)):Y(t,"highWaterMark")&&(e.highWaterMark=t.highWaterMark,!Pt(e.highWaterMark))?new TypeError(C("invalid option. `%s` option must be a nonnegative number. Option: `%s`.","highWaterMark",e.highWaterMark)):Y(t,"serialize")&&(e.serialize=t.serialize,!Oe(e.serialize))?new TypeError(C("invalid option. `%s` option must be a function. Option: `%s`.","serialize",e.serialize)):Y(t,"iter")&&(e.iter=t.iter,!Tr(e.iter))?new TypeError(C("invalid option. `%s` option must be a nonnegative integer. Option: `%s`.","iter",e.iter)):Y(t,"dir")&&(e.dir=t.dir,1!==e.dir&&-1!==e.dir)?new TypeError(C("invalid option. `%s` option must be either `1` or `-1`. Option: `%s`.","dir",e.dir)):null:new TypeError(C("invalid argument. Options argument must be an object. Value: `%s`.",t))}(r,t),n))throw n;return Vr("Creating a readable stream configured with the following options: %s.",JSON.stringify(r)),xr.call(this,r),Wt(this,"_destroyed",!1),B(this,"_objectMode",r.objectMode),B(this,"_sep",r.sep),B(this,"_serialize",r.serialize||JSON.stringify),B(this,"_src",e),B(this,"_stride",r.dir),B(this,"_iter",r.iter),Wt(this,"_i",0),Wt(this,"_idx",1===r.dir?-1:e.length),this}xt(Wr,xr),B(Wr.prototype,"_read",(function(){var e,t,r;if(!this._destroyed)for(e=!0;e;){if(t=null,this._i+=1,this._i>this._iter||0===this._src.length)return Vr("Finished iteration."),this.push(null);this._idx+=this._stride,this._stride>0&&this._idx>=this._src.length?this._idx%=this._src.length:this._stride<0&&this._idx<0&&(this._idx+=this._src.length),r=this._src[this._idx],Vr("Value: %s. Idx: %d. Iter: %d.",JSON.stringify(r),this._idx,this._i),!1===this._objectMode&&("string"==typeof(r=this._serialize(r))?r=1===this._i?vr(r):vr(this._sep+r):we(r)?this._i>1&&(r=wr.concat([vr(this._sep),r])):t=new Error(C("invalid operation. Serialization function must return a string or Buffer. Value: `%s`.",r))),t?this.emit("error",t):e=this.push(r)}})),B(Wr.prototype,"destroy",(function(e){var t;return this._destroyed?(Vr("Attempted to destroy an already destroyed stream."),this):(t=this,this._destroyed=!0,It((function(){e&&(Vr("Stream was destroyed due to an error. Error: %s.",cr(e)?e.message:JSON.stringify(e)),t.emit("error",e));Vr("Closing the stream..."),t.emit("close")})),this)})),B(Wr,"objectMode",(function(e,t){var r;if(arguments.length>1){if(!Rt(r=t))throw new TypeError(C("invalid argument. Options argument must be an object. Value: `%s`.",r));r=Et({},t)}else r={};return r.objectMode=!0,new Wr(e,r)})),B(Wr,"factory",(function(e){var t;if(arguments.length){if(!Rt(e))throw new TypeError(C("invalid argument. Options argument must be an object. Value: `%s`.",e));t=Et({},e)}else t={};return function(e){return new Wr(e,t)}}));var Cr="function"==typeof Uint8Array;function Ir(e){return Cr&&e instanceof Uint8Array||"[object Uint8Array]"===Q(e)}var Nr=Object.prototype.toString;var Ar=new Function("try {return this === global;} catch ( err ) {return false;}")(),zr=t,Hr=le(),Jr=/node|io\.js/;var Fr,Rr,Pr="object"==typeof global&&global===Hr&&Hr===Hr.global&&("[object global]"===Q(Hr)||"[object Object]"===Q(Hr))&&!0===Ar&&"object"==typeof zr&&"[object process]"===(Fr=zr,Nr.call(Fr))&&Rt(zr.versions)&&xe(zr.versions.node)&&(void 0===zr.release||Rt(zr.release)&&xe(zr.release.name)&&Jr.test(zr.release.name)),Br=t.versions.node,Lr=(Rr=Pr?Br:null,Rr?parseInt(Rr.split(".")[0],10):-1),$r=Oe(wr.from)&&Lr>=5,Ur="function"==typeof ArrayBuffer;function qr(e){return Ur&&e instanceof ArrayBuffer||"[object ArrayBuffer]"===Q(e)}var Gr="function"==typeof Uint8Array?Uint8Array:null;var Xr,Zr="function"==typeof Uint8Array?Uint8Array:void 0;Xr=function(){var e,t;if("function"!=typeof Gr)return!1;try{e=Ir(t=new Gr(t=[1,3.14,-3.14,256,257]))&&1===t[0]&&3===t[1]&&253===t[2]&&0===t[3]&&1===t[4]}catch(t){e=!1}return e}()?Zr:function(){throw new Error("not implemented")};var Yr=Xr;var Dr,Kr=Oe(wr.from)?function(e){if(!ut(e))throw new TypeError(C("invalid argument. Must provide an array-like object. Value: `%s`.",e));return wr.from(e)}:function(e){if(!ut(e))throw new TypeError(C("invalid argument. Must provide an array-like object. Value: `%s`.",e));return new wr(e)};Dr=$r?function(e,t,r){var n,i;if(!qr(e))throw new TypeError(C("invalid argument. First argument must be an ArrayBuffer. Value: `%s`.",e));if(arguments.length>1){if(!Tr(t))throw new TypeError(C("invalid argument. Second argument must be a nonnegative integer. Value: `%s`.",t));if(t>e.byteLength)throw new RangeError(C("invalid argument. Second argument must not exceed the number of bytes in the input ArrayBuffer. Value: `%s`.",t));if(n=t,arguments.length>2){if(!Tr(r))throw new TypeError(C("invalid argument. Last argument must be a nonnegative integer. Value: `%s`.",r));if(r>e.byteLength)throw new RangeError(C("invalid argument. Last argument must not exceed the number of bytes in the input ArrayBuffer. Value: `%s`.",r));i=r}else i=e.byteLength-n}else n=0,i=e.byteLength;return 0===i&&Lr<6?wr.from([]):wr.from(e,n,i)}:function(e,t,r){var n;if(!qr(e))throw new TypeError(C("invalid argument. First argument must be an ArrayBuffer. Value: `%s`.",e));if(arguments.length>1){if(!Tr(t))throw new TypeError(C("invalid argument. Second argument must be a nonnegative integer. Value: `%s`.",t));if(t>e.byteLength)throw new RangeError(C("invalid argument. Second argument must not exceed the number of bytes in the input ArrayBuffer. Value: `%s`.",t));if(arguments.length>2){if(!Tr(r))throw new TypeError(C("invalid argument. Last argument must be a nonnegative integer. Value: `%s`.",r));if(r>e.byteLength)throw new RangeError(C("invalid argument. Last argument must not exceed the number of bytes in the input ArrayBuffer. Value: `%s`.",r));n=r}else n=e.byteLength-t;return Kr(new Yr(e,t,n))}return Lr<3?Kr(new Yr(e)):0===e.byteLength?new wr([]):new wr(e)};var Qr=Dr,en={objectMode:!1,encoding:null,sep:"\n",iter:1e308};var tn=$t("from-constant-stream"),rn=e.Readable;function nn(e,t){var r,n;if(!(this instanceof nn))return arguments.length>1?new nn(e,t):new nn(e);if(r=Et({},en),arguments.length>1&&(n=function(e,t){return Rt(t)?Y(t,"sep")&&(e.sep=t.sep,!xe(e.sep))?new TypeError(C("invalid option. `%s` option must be a string. Option: `%s`.","sep",e.sep)):Y(t,"objectMode")&&(e.objectMode=t.objectMode,!U(e.objectMode))?new TypeError(C("invalid option. `%s` option must be a boolean. Option: `%s`.","objectMode",e.objectMode)):Y(t,"encoding")&&(e.encoding=t.encoding,!xe(e.encoding)&&null!==e.encoding)?new TypeError(C("invalid option. `%s` option must be a string or null. Option: `%s`.","encoding",e.encoding)):Y(t,"highWaterMark")&&(e.highWaterMark=t.highWaterMark,!Pt(e.highWaterMark))?new TypeError(C("invalid option. `%s` option must be a nonnegative number. Option: `%s`.","highWaterMark",e.highWaterMark)):Y(t,"iter")&&(e.iter=t.iter,!Tr(e.iter))?new TypeError(C("invalid option. `%s` option must be a nonnegative integer. Option: `%s`.","iter",e.iter)):null:new TypeError(C("invalid argument. Options argument must be an object. Value: `%s`.",t))}(r,t),n))throw n;if(!1===r.objectMode)if(xe(e))e=vr(e);else if(we(e));else{if(!Ir(e))throw new TypeError(C("invalid argument. In binary mode, a provided value must be a string, Buffer, or Uint8Array. Value: `%s`.",e));e=Qr(e.buffer,e.byteOffset,e.length)}return tn("Creating a readable stream configured with the following options: %s.",JSON.stringify(r)),rn.call(this,r),Wt(this,"_destroyed",!1),B(this,"_objectMode",r.objectMode),B(this,"_sep",vr(r.sep)),B(this,"_iter",r.iter),B(this,"_value",e),Wt(this,"_i",0),this}xt(nn,rn),B(nn.prototype,"_read",(function(){var e;if(!this._destroyed)for(e=!0;e;){if(this._i+=1,this._i>this._iter)return tn("Finished iteration."),this.push(null);tn("Value: %s. Iter: %d.",this._value,this._i),e=!1===this._objectMode&&this._i>1?this.push(wr.concat([this._sep,this._value])):this.push(this._value)}})),B(nn.prototype,"destroy",(function(e){var t;return this._destroyed?(tn("Attempted to destroy an already destroyed stream."),this):(t=this,this._destroyed=!0,It((function(){e&&(tn("Stream was destroyed due to an error. Error: %s.",cr(e)?e.message:JSON.stringify(e)),t.emit("error",e));tn("Closing the stream..."),t.emit("close")})),this)})),B(nn,"objectMode",(function(e,t){var r;if(arguments.length>1){if(!Rt(r=t))throw new TypeError(C("invalid argument. Options argument must be an object. Value: `%s`.",r));r=Et({},t)}else r={};return r.objectMode=!0,new nn(e,r)})),B(nn,"factory",(function(e,t){var r,n,i;if(0===(r=arguments.length))n={},i=!0;else if(1===r)null!==e&&"object"==typeof e&&(Y(e,"sep")||Y(e,"iter")||Y(e,"objectMode")||Y(e,"encoding")||Y(e,"highWaterMark"))?(n=Et({},e),i=!0):n={};else{if(!Rt(t))throw new TypeError(C("invalid argument. Options argument must be an object. Value: `%s`.",t));n=Et({},t)}return i?function(e){return new nn(e,n)}:function(){return new nn(e,n)}}));var on={objectMode:!1,encoding:null,sep:"\n"};var an=$t("from-iterator-stream"),sn=e.Readable;function un(e,t){var r,n;if(!(this instanceof un))return arguments.length>1?new un(e,t):new un(e);if(!function(e){var t=typeof e;return null!==e&&("object"===t||"function"===t)&&Oe(e.next)}(e))throw new TypeError(C("invalid argument. First argument must be an iterator. Value: `%s`.",e));if(r=Et({},on),arguments.length>1&&(n=function(e,t){return Rt(t)?Y(t,"sep")&&(e.sep=t.sep,!xe(e.sep))?new TypeError(C("invalid option. `%s` option must be a string. Option: `%s`.","sep",e.sep)):Y(t,"objectMode")&&(e.objectMode=t.objectMode,!U(e.objectMode))?new TypeError(C("invalid option. `%s` option must be a boolean. Option: `%s`.","objectMode",e.objectMode)):Y(t,"encoding")&&(e.encoding=t.encoding,!xe(e.encoding)&&null!==e.encoding)?new TypeError(C("invalid option. `%s` option must be a string or null. Option: `%s`.","encoding",e.encoding)):Y(t,"highWaterMark")&&(e.highWaterMark=t.highWaterMark,!Pt(e.highWaterMark))?new TypeError(C("invalid option. `%s` option must be a nonnegative number. Option: `%s`.","highWaterMark",e.highWaterMark)):Y(t,"serialize")&&(e.serialize=t.serialize,!Oe(e.serialize))?new TypeError(C("invalid option. `%s` option must be a function. Option: `%s`.","serialize",e.serialize)):null:new TypeError(C("invalid argument. Options argument must be an object. Value: `%s`.",t))}(r,t),n))throw n;return an("Creating a readable stream configured with the following options: %s.",JSON.stringify(r)),sn.call(this,r),Wt(this,"_destroyed",!1),B(this,"_objectMode",r.objectMode),B(this,"_sep",r.sep),B(this,"_serialize",r.serialize||JSON.stringify),B(this,"_iterator",e),Wt(this,"_i",0),this}xt(un,sn),B(un.prototype,"_read",(function(){var e,t,r;if(!this._destroyed)for(e=!0;e;){if(r=this._iterator.next(),this._i+=1,r.done)return Y(r,"value")&&(r=r.value,an("Value: %s. Iter: %d.",JSON.stringify(r),this._i),!1===this._objectMode&&("string"==typeof(r=this._serialize(r))?(r=1===this._i?vr(r):vr(this._sep+r),this.push(r)):we(r)?(this._i>1&&(r=wr.concat([vr(this._sep),r])),this.push(r)):(t=new Error(C("invalid operation. Serialization function must return a string or Buffer. Value: `%s`.",r)),this.emit("error",t)))),an("Finished iteration."),this.push(null);if(r=r.value,an("Value: %s. Iter: %d.",JSON.stringify(r),this._i),!1===this._objectMode)if("string"==typeof(r=this._serialize(r)))r=1===this._i?vr(r):vr(this._sep+r);else{if(!we(r)){t=new Error(C("invalid operation. Serialization function must return a string or Buffer. Value: `%s`.",r)),this.emit("error",t);continue}this._i>1&&(r=wr.concat([vr(this._sep),r]))}e=this.push(r)}})),B(un.prototype,"destroy",(function(e){var t;return this._destroyed?(an("Attempted to destroy an already destroyed stream."),this):(t=this,this._destroyed=!0,It((function(){e&&(an("Stream was destroyed due to an error. Error: %s.",cr(e)?e.message:JSON.stringify(e)),t.emit("error",e));an("Closing the stream..."),t.emit("close")})),this)})),B(un,"objectMode",(function(e,t){var r;if(arguments.length>1){if(!Rt(r=t))throw new TypeError(C("invalid argument. Options argument must be an object. Value: `%s`.",r));r=Et({},t)}else r={};return r.objectMode=!0,new un(e,r)})),B(un,"factory",(function(e){var t;if(arguments.length){if(!Rt(e))throw new TypeError(C("invalid argument. Options argument must be an object. Value: `%s`.",e));t=Et({},e)}else t={};return function(e){return new un(e,t)}}));var ln={objectMode:!1,encoding:null,sep:"\n"};var cn=$t("from-strided-array-stream"),dn=e.Readable;function fn(e,t,r,n,i){var o,a,s;if(!(this instanceof fn))return arguments.length>4?new fn(e,t,r,n,i):new fn(e,t,r,n);if(!Tr(e))throw new TypeError(C("invalid argument. First argument must be a nonnegative integer. Value: `%s`.",e));if(!ut(t))throw new TypeError(C("invalid argument. Second argument must be an array-like object. Value: `%s`.",t));if(!Ye(r))throw new TypeError(C("invalid argument. Third argument must be an integer. Value: `%s`.",r));if(!Tr(n))throw new TypeError(C("invalid argument. Fourth argument must be a nonnegative integer. Value: `%s`.",n));if(e>0&&(s=n+(e-1)*r,n>=t.length||s<0||s>=t.length))throw new RangeError("invalid arguments. Strided array parameters are incompatible with the provided array-like object. Linear index exceeds array bounds.");if(o=Et({},ln),arguments.length>4&&(a=function(e,t){return Rt(t)?Y(t,"sep")&&(e.sep=t.sep,!xe(e.sep))?new TypeError(C("invalid option. `%s` option must be a string. Option: `%s`.","sep",e.sep)):Y(t,"objectMode")&&(e.objectMode=t.objectMode,!U(e.objectMode))?new TypeError(C("invalid option. `%s` option must be a boolean. Option: `%s`.","objectMode",e.objectMode)):Y(t,"encoding")&&(e.encoding=t.encoding,!xe(e.encoding)&&null!==e.encoding)?new TypeError(C("invalid option. `%s` option must be a string or null. Option: `%s`.","encoding",e.encoding)):Y(t,"highWaterMark")&&(e.highWaterMark=t.highWaterMark,!Pt(e.highWaterMark))?new TypeError(C("invalid option. `%s` option must be a nonnegative number. Option: `%s`.","highWaterMark",e.highWaterMark)):Y(t,"serialize")&&(e.serialize=t.serialize,!Oe(e.serialize))?new TypeError(C("invalid option. `%s` option must be a function. Option: `%s`.","serialize",e.serialize)):null:new TypeError(C("invalid argument. Options argument must be an object. Value: `%s`.",t))}(o,i),a))throw a;return cn("Creating a readable stream configured with the following options: %s.",JSON.stringify(o)),dn.call(this,o),Wt(this,"_destroyed",!1),B(this,"_objectMode",o.objectMode),B(this,"_sep",o.sep),B(this,"_serialize",o.serialize||JSON.stringify),B(this,"_buffer",t),B(this,"_N",e),B(this,"_stride",r),B(this,"_offset",n),Wt(this,"_idx",n),Wt(this,"_i",0),this}xt(fn,dn),B(fn.prototype,"_read",(function(){var e,t,r;if(!this._destroyed)for(e=!0;e;){if(t=null,this._i+=1,this._i>this._N)return cn("Finished iteration."),this.push(null);r=this._buffer[this._idx],cn("Value: %s. Idx: %d. Iter: %d.",JSON.stringify(r),this._idx,this._i),this._idx+=this._stride,!1===this._objectMode&&("string"==typeof(r=this._serialize(r))?r=1===this._i?vr(r):vr(this._sep+r):we(r)?this._i>1&&(r=wr.concat([vr(this._sep),r])):t=new Error(C("invalid operation. Serialization function must return a string or Buffer. Value: `%s`.",r))),t?this.emit("error",t):e=this.push(r)}})),B(fn.prototype,"destroy",(function(e){var t;return this._destroyed?(cn("Attempted to destroy an already destroyed stream."),this):(t=this,this._destroyed=!0,It((function(){e&&(cn("Stream was destroyed due to an error. Error: %s.",cr(e)?e.message:JSON.stringify(e)),t.emit("error",e));cn("Closing the stream..."),t.emit("close")})),this)})),B(fn,"objectMode",(function(e,t,r,n,i){var o;if(arguments.length>4){if(!Rt(o=i))throw new TypeError(C("invalid argument. Options argument must be an object. Value: `%s`.",o));o=Et({},i)}else o={};return o.objectMode=!0,new fn(e,t,r,n,o)})),B(fn,"factory",(function(e){var t;if(arguments.length){if(!Rt(e))throw new TypeError(C("invalid argument. Options argument must be an object. Value: `%s`.",e));t=Et({},e)}else t={};return function(e,r,n,i){return new fn(e,r,n,i,t)}}));var pn=$t("join-stream"),hn=e.Transform;function gn(e){var t,r;if(!(this instanceof gn))return arguments.length?new gn(e):new gn;if(t={objectMode:!1,encoding:null,allowHalfOpen:!1,readableObjectMode:!1,sep:"\n"},arguments.length&&(r=function(e,t){return Rt(t)?Y(t,"sep")&&(e.sep=t.sep,!xe(e.sep))?new TypeError(C("invalid option. `%s` option must be a string. Option: `%s`.","sep",e.sep)):Y(t,"objectMode")&&(e.objectMode=t.objectMode,!U(e.objectMode))?new TypeError(C("invalid option. `%s` option must be a boolean. Option: `%s`.","objectMode",e.objectMode)):Y(t,"readableObjectMode")&&(e.readableObjectMode=t.readableObjectMode,!U(e.readableObjectMode))?new TypeError(C("invalid option. `%s` option must be a boolean. Option: `%s`.","readableObjectMode",e.readableObjectMode)):Y(t,"encoding")&&(e.encoding=t.encoding,!xe(e.encoding))?new TypeError(C("invalid option. `%s` option must be a string. Option: `%s`.","encoding",e.encoding)):Y(t,"allowHalfOpen")&&(e.allowHalfOpen=t.allowHalfOpen,!U(e.allowHalfOpen))?new TypeError(C("invalid option. `%s` option must be a boolean. Option: `%s`.","allowHalfOpen",e.allowHalfOpen)):Y(t,"highWaterMark")&&(e.highWaterMark=t.highWaterMark,!Pt(e.highWaterMark))?new TypeError(C("invalid option. `%s` option must be a nonnegative number. Option: `%s`.","highWaterMark",e.highWaterMark)):null:new TypeError(C("invalid argument. Options argument must be an object. Value: `%s`.",t))}(t,e),r))throw r;return t.writableObjectMode=!0,t.decodeStrings=!1,pn("Creating a transform stream configured with the following options: %s.",JSON.stringify(t)),hn.call(this,t),Wt(this,"_destroyed",!1),B(this,"_encoding",null===t.encoding?"utf8":t.encoding),"utf8"!==this._encoding&&(t.sep=vr(t.sep,this._encoding)),B(this,"_sep",t.sep),Wt(this,"_init",!1),Wt(this,"_idx",-1),this}xt(gn,hn),B(gn.prototype,"_transform",(function(e,t,r){var n;this._idx+=1,pn("Received a new chunk. Chunk: %s. Encoding: %s. Index: %d.",e.toString(),t,this._idx),"utf8"===this._encoding?this._init?e=this._sep+e:this._init=!0:this._init?(e=new wr(e,t),n=this._sep.length+e.length,e=(e=wr.concat([this._sep,e],n)).toString(this._encoding)):this._init=!0,this.push(e,this._encoding),r()})),B(gn.prototype,"_flush",(function(e){pn("Flushing the stream..."),e()})),B(gn.prototype,"destroy",(function(e){var t;return this._destroyed?(pn("Attempted to destroy an already destroyed stream."),this):(t=this,this._destroyed=!0,It((function(){e&&(pn("Stream was destroyed due to an error. Error: %s.",JSON.stringify(e)),t.emit("error",e));pn("Closing the stream..."),t.emit("close")})),this)})),B(gn,"objectMode",(function(e){var t;if(arguments.length){if(!Rt(e))throw new TypeError(C("invalid argument. Options argument must be an object. Value: `%s`.",e));t=Et({},e)}else t={};return t.objectMode=!0,new gn(t)})),B(gn,"factory",(function(e){var t;if(arguments.length){if(!Rt(e))throw new TypeError(C("invalid argument. Options argument must be an object. Value: `%s`.",e));t=Et({},e)}else t={};return function(){return new gn(t)}}));var bn={objectMode:!1,encoding:null,allowHalfOpen:!1,writableObjectMode:!1,sep:null},mn=RegExp.prototype.exec;var yn=G();function wn(e){return"object"==typeof e&&(e instanceof RegExp||(yn?function(e){try{return mn.call(e),!0}catch(e){return!1}}(e):"[object RegExp]"===Q(e)))}var vn=$t("split-stream");function jn(e,t){return"utf8"===t||"buffer"===t?e:(e=vr(e),t?e.toString(t):e.toString())}var On=e.Transform,_n=/\r?\n/;function Mn(e){var t,r;if(!(this instanceof Mn))return arguments.length?new Mn(e):new Mn;if(t=Et({},bn),arguments.length&&(r=function(e,t){return Rt(t)?!Y(t,"sep")||(e.sep=t.sep,xe(e.sep)||wn(e.sep))?Y(t,"objectMode")&&(e.objectMode=t.objectMode,!U(e.objectMode))?new TypeError(C("invalid option. `%s` option must be a boolean. Option: `%s`.","objectMode",e.objectMode)):Y(t,"writableObjectMode")&&(e.writableObjectMode=t.writableObjectMode,!U(e.writableObjectMode))?new TypeError(C("invalid option. `%s` option must be a boolean. Option: `%s`.","writableObjectMode",e.writableObjectMode)):Y(t,"encoding")&&(e.encoding=t.encoding,!xe(e.encoding))?new TypeError(C("invalid option. `%s` option must be a string. Option: `%s`.","encoding",e.encoding)):Y(t,"allowHalfOpen")&&(e.allowHalfOpen=t.allowHalfOpen,!U(e.allowHalfOpen))?new TypeError(C("invalid option. `%s` option must be a boolean. Option: `%s`.","allowHalfOpen",e.allowHalfOpen)):Y(t,"highWaterMark")&&(e.highWaterMark=t.highWaterMark,!Pt(e.highWaterMark))?new TypeError(C("invalid option. `%s` option must be a nonnegative number. Option: `%s`.","highWaterMark",e.highWaterMark)):null:new TypeError(C("invalid option. `%s` option must be either a string or a regular expression. Option: `%s`.","sep",e.sep)):new TypeError(C("invalid argument. Options argument must be an object. Value: `%s`.",t))}(t,e),r))throw r;return t.readableObjectMode=!0,t.decodeStrings=!1,vn("Creating a transform stream configured with the following options: %s.",JSON.stringify(t)),On.call(this,t),B(this,"_sep",null===t.sep?_n:t.sep),Wt(this,"_destroyed",!1),B(this,"_encoding",t.encoding),Wt(this,"_buffer",""),Wt(this,"_idx",-1),this}xt(Mn,On),B(Mn.prototype,"_transform",(function(e,t,r){var n,i,o,a;if(this._idx+=1,vn("Received a new chunk. Chunk: %s. Encoding: %s. Index: %d.",e.toString(),t,this._idx),"buffer"===t?e=e.toString():"utf8"!==t&&(e=(e=new wr(e,t)).toString("utf8")),n=e.split(this._sep),vn("Splits: %s. Index: %d.",JSON.stringify(n),this._idx),o=n.length-1,vn("%s splits. Index: %d.",o,this._idx),0===o)vn("No splits. Index: %d.",this._idx),this._buffer+=n[o];else{for(vn("Processing splits. Index: %d.",this._index),i=jn(i=this._buffer+n[0],t),vn("Split %d: %s. Index: %d.",0,i.toString(),this._idx),this.push(i,t),a=1;a1?t.flush=r:delete t.flush;return new Hn(t)}})),B(Hn,"ctor",(function(e){var t,r,n;if(r=Et({},kn),arguments.length&&(n=Vn(r,e)))throw n;function i(e){var t,n;if(!(this instanceof i))return arguments.length?new i(e):new i;if(t=Et({},r),arguments.length&&(n=Vn(t,e)))throw n;return Rn("Creating a transform stream configured with the following options: %s.",JSON.stringify(t)),Fn.call(this,t),this._destroyed=!1,this}return t=r.transform?r.transform:In,xt(i,Fn),i.prototype._transform=t,r.flush&&(i.prototype._flush=r.flush),i.prototype.destroy=Wn,i}));var Pn={};return P(Pn,"debugStream",Qt),P(Pn,"debugSinkStream",lr),P(Pn,"emptyStream",hr),P(Pn,"arrayStream",Mr),P(Pn,"circularArrayStream",Wr),P(Pn,"constantStream",nn),P(Pn,"iteratorStream",un),P(Pn,"stridedArrayStream",fn),P(Pn,"inspectStream",Gt),P(Pn,"inspectSinkStream",nr),P(Pn,"joinStream",gn),P(Pn,"splitStream",Mn),P(Pn,"stderr",En),P(Pn,"stdin",Tn),P(Pn,"stdout",Sn),P(Pn,"transformStream",Hn),Pn})); +//# sourceMappingURL=index.js.map diff --git a/index.js.map b/index.js.map new file mode 100644 index 0000000..fd50e26 --- /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/utils-type-of/lib/fixtures/re.js","../node_modules/@stdlib/assert-is-boolean/lib/primitive.js","../node_modules/@stdlib/assert-has-tostringtag-support/lib/main.js","../node_modules/@stdlib/assert-has-symbol-support/lib/main.js","../node_modules/@stdlib/utils-native-class/lib/tostring.js","../node_modules/@stdlib/assert-has-own-property/lib/main.js","../node_modules/@stdlib/symbol-ctor/lib/main.js","../node_modules/@stdlib/utils-native-class/lib/tostringtag.js","../node_modules/@stdlib/utils-native-class/lib/index.js","../node_modules/@stdlib/utils-native-class/lib/polyfill.js","../node_modules/@stdlib/utils-native-class/lib/main.js","../node_modules/@stdlib/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-global/lib/main.js","../node_modules/@stdlib/utils-global/lib/codegen.js","../node_modules/@stdlib/utils-type-of/lib/fixtures/nodelist.js","../node_modules/@stdlib/utils-type-of/lib/fixtures/typedarray.js","../node_modules/@stdlib/regexp-function-name/lib/main.js","../node_modules/@stdlib/regexp-function-name/lib/regexp.js","../node_modules/@stdlib/assert-is-array/lib/main.js","../node_modules/@stdlib/regexp-function-name/lib/index.js","../node_modules/@stdlib/assert-is-object-like/lib/main.js","../node_modules/@stdlib/assert-is-object-like/lib/index.js","../node_modules/@stdlib/assert-tools-array-function/lib/main.js","../node_modules/@stdlib/assert-is-buffer/lib/main.js","../node_modules/@stdlib/utils-constructor-name/lib/main.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/object-assign/lib/has_object_assign.js","../node_modules/@stdlib/object-assign/lib/builtin.js","../node_modules/@stdlib/utils-keys/lib/builtin.js","../node_modules/@stdlib/utils-keys/lib/has_builtin.js","../node_modules/@stdlib/assert-is-arguments/lib/detect.js","../node_modules/@stdlib/assert-is-arguments/lib/main.js","../node_modules/@stdlib/assert-is-string/lib/primitive.js","../node_modules/@stdlib/assert-is-string/lib/valueof.js","../node_modules/@stdlib/assert-is-string/lib/object.js","../node_modules/@stdlib/assert-is-string/lib/try2valueof.js","../node_modules/@stdlib/assert-is-string/lib/main.js","../node_modules/@stdlib/assert-is-number/lib/primitive.js","../node_modules/@stdlib/assert-is-string/lib/index.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/math-base-assert-is-nan/lib/main.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-number/lib/index.js","../node_modules/@stdlib/assert-is-nan/lib/index.js","../node_modules/@stdlib/constants-float64-pinf/lib/index.js","../node_modules/@stdlib/constants-float64-ninf/lib/index.js","../node_modules/@stdlib/math-base-special-floor/lib/main.js","../node_modules/@stdlib/math-base-assert-is-integer/lib/main.js","../node_modules/@stdlib/assert-is-integer/lib/integer.js","../node_modules/@stdlib/assert-is-integer/lib/primitive.js","../node_modules/@stdlib/assert-is-integer/lib/object.js","../node_modules/@stdlib/assert-is-integer/lib/main.js","../node_modules/@stdlib/assert-is-integer/lib/index.js","../node_modules/@stdlib/assert-is-enumerable-property/lib/native.js","../node_modules/@stdlib/assert-is-enumerable-property/lib/has_string_enumerability_bug.js","../node_modules/@stdlib/assert-is-enumerable-property/lib/main.js","../node_modules/@stdlib/constants-uint32-max/lib/index.js","../node_modules/@stdlib/assert-is-arguments/lib/index.js","../node_modules/@stdlib/assert-is-arguments/lib/polyfill.js","../node_modules/@stdlib/utils-keys/lib/builtin_wrapper.js","../node_modules/@stdlib/utils-keys/lib/has_enumerable_prototype_bug.js","../node_modules/@stdlib/utils-noop/lib/main.js","../node_modules/@stdlib/utils-keys/lib/has_non_enumerable_properties_bug.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/utils-index-of/lib/main.js","../node_modules/@stdlib/utils-keys/lib/is_constructor_prototype.js","../node_modules/@stdlib/utils-keys/lib/window.js","../node_modules/@stdlib/utils-keys/lib/has_automation_equality_bug.js","../node_modules/@stdlib/utils-keys/lib/has_window.js","../node_modules/@stdlib/utils-keys/lib/main.js","../node_modules/@stdlib/utils-keys/lib/has_arguments_bug.js","../node_modules/@stdlib/utils-keys/lib/polyfill.js","../node_modules/@stdlib/utils-keys/lib/is_constructor_prototype_wrapper.js","../node_modules/@stdlib/utils-property-symbols/lib/index.js","../node_modules/@stdlib/utils-property-symbols/lib/has_builtin.js","../node_modules/@stdlib/object-ctor/lib/main.js","../node_modules/@stdlib/utils-property-symbols/lib/builtin.js","../node_modules/@stdlib/utils-property-symbols/lib/polyfill.js","../node_modules/@stdlib/object-assign/lib/index.js","../node_modules/@stdlib/utils-enumerable-properties/lib/main.js","../node_modules/@stdlib/object-assign/lib/polyfill.js","../node_modules/@stdlib/utils-inherit/lib/validate.js","../node_modules/@stdlib/utils-inherit/lib/native.js","../node_modules/@stdlib/utils-inherit/lib/polyfill.js","../node_modules/@stdlib/utils-inherit/lib/detect.js","../node_modules/@stdlib/utils-inherit/lib/main.js","../node_modules/@stdlib/utils-define-nonenumerable-property/lib/main.js","../node_modules/@stdlib/utils-next-tick/lib/main.js","../node_modules/@stdlib/utils-get-prototype-of/lib/native.js","../node_modules/@stdlib/utils-get-prototype-of/lib/detect.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","../node_modules/@stdlib/assert-is-object/lib/main.js","../node_modules/@stdlib/assert-is-nonnegative-number/lib/primitive.js","../node_modules/@stdlib/assert-is-nonnegative-number/lib/object.js","../node_modules/@stdlib/assert-is-nonnegative-number/lib/main.js","../node_modules/@stdlib/assert-is-nonnegative-number/lib/index.js","../node_modules/@stdlib/streams-node-inspect/lib/debug.js","../node_modules/@stdlib/streams-node-inspect/lib/main.js","../node_modules/@stdlib/streams-node-inspect/lib/validate.js","../node_modules/@stdlib/streams-node-inspect/lib/index.js","../node_modules/@stdlib/streams-node-inspect/lib/object_mode.js","../node_modules/@stdlib/streams-node-inspect/lib/factory.js","../node_modules/@stdlib/streams-node-debug/lib/namespace.js","../node_modules/@stdlib/streams-node-debug/lib/debug.js","../node_modules/@stdlib/streams-node-debug/lib/validate.js","../node_modules/@stdlib/streams-node-debug/lib/logger.js","../node_modules/@stdlib/streams-node-debug/lib/main.js","../node_modules/@stdlib/streams-node-debug/lib/index.js","../node_modules/@stdlib/streams-node-debug/lib/object_mode.js","../node_modules/@stdlib/streams-node-debug/lib/factory.js","../node_modules/@stdlib/streams-node-inspect-sink/lib/debug.js","../node_modules/@stdlib/streams-node-inspect-sink/lib/main.js","../node_modules/@stdlib/streams-node-inspect-sink/lib/validate.js","../node_modules/@stdlib/streams-node-inspect-sink/lib/index.js","../node_modules/@stdlib/streams-node-inspect-sink/lib/object_mode.js","../node_modules/@stdlib/streams-node-inspect-sink/lib/factory.js","../node_modules/@stdlib/streams-node-debug-sink/lib/namespace.js","../node_modules/@stdlib/streams-node-debug-sink/lib/debug.js","../node_modules/@stdlib/streams-node-debug-sink/lib/validate.js","../node_modules/@stdlib/streams-node-debug-sink/lib/logger.js","../node_modules/@stdlib/streams-node-debug-sink/lib/main.js","../node_modules/@stdlib/assert-is-error/lib/main.js","../node_modules/@stdlib/streams-node-debug-sink/lib/index.js","../node_modules/@stdlib/streams-node-debug-sink/lib/object_mode.js","../node_modules/@stdlib/streams-node-debug-sink/lib/factory.js","../node_modules/@stdlib/streams-node-empty/lib/debug.js","../node_modules/@stdlib/streams-node-empty/lib/main.js","../node_modules/@stdlib/streams-node-empty/lib/validate.js","../node_modules/@stdlib/streams-node-empty/lib/index.js","../node_modules/@stdlib/streams-node-empty/lib/object_mode.js","../node_modules/@stdlib/streams-node-empty/lib/factory.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","../node_modules/@stdlib/streams-node-from-array/lib/debug.js","../node_modules/@stdlib/streams-node-from-array/lib/main.js","../node_modules/@stdlib/streams-node-from-array/lib/validate.js","../node_modules/@stdlib/streams-node-from-array/lib/index.js","../node_modules/@stdlib/streams-node-from-array/lib/object_mode.js","../node_modules/@stdlib/streams-node-from-array/lib/factory.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-nonnegative-integer/lib/index.js","../node_modules/@stdlib/streams-node-from-circular-array/lib/debug.js","../node_modules/@stdlib/streams-node-from-circular-array/lib/main.js","../node_modules/@stdlib/streams-node-from-circular-array/lib/validate.js","../node_modules/@stdlib/streams-node-from-circular-array/lib/index.js","../node_modules/@stdlib/streams-node-from-circular-array/lib/object_mode.js","../node_modules/@stdlib/streams-node-from-circular-array/lib/factory.js","../node_modules/@stdlib/assert-is-uint8array/lib/main.js","../node_modules/@stdlib/assert-is-node/lib/to_string.js","../node_modules/@stdlib/assert-is-node/lib/global_scope.js","../node_modules/@stdlib/assert-is-node/lib/main.js","../node_modules/@stdlib/assert-is-node/lib/index.js","../node_modules/@stdlib/process-node-version/lib/index.js","../node_modules/@stdlib/process-node-version/lib/main.js","../node_modules/@stdlib/process-node-version/lib/process.js","../node_modules/@stdlib/buffer-from-arraybuffer/lib/node_version.js","../node_modules/@stdlib/process-node-version/lib/browser.js","../node_modules/@stdlib/buffer-from-arraybuffer/lib/has_from.js","../node_modules/@stdlib/assert-is-arraybuffer/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/buffer-from-array/lib/index.js","../node_modules/@stdlib/buffer-from-arraybuffer/lib/index.js","../node_modules/@stdlib/buffer-from-array/lib/has_from.js","../node_modules/@stdlib/buffer-from-array/lib/main.js","../node_modules/@stdlib/buffer-from-array/lib/polyfill.js","../node_modules/@stdlib/buffer-from-arraybuffer/lib/main.js","../node_modules/@stdlib/buffer-from-arraybuffer/lib/polyfill.js","../node_modules/@stdlib/streams-node-from-constant/lib/debug.js","../node_modules/@stdlib/streams-node-from-constant/lib/main.js","../node_modules/@stdlib/streams-node-from-constant/lib/validate.js","../node_modules/@stdlib/streams-node-from-constant/lib/index.js","../node_modules/@stdlib/streams-node-from-constant/lib/object_mode.js","../node_modules/@stdlib/streams-node-from-constant/lib/factory.js","../node_modules/@stdlib/streams-node-from-iterator/lib/debug.js","../node_modules/@stdlib/streams-node-from-iterator/lib/main.js","../node_modules/@stdlib/assert-is-iterator-like/lib/main.js","../node_modules/@stdlib/streams-node-from-iterator/lib/validate.js","../node_modules/@stdlib/streams-node-from-iterator/lib/index.js","../node_modules/@stdlib/streams-node-from-iterator/lib/object_mode.js","../node_modules/@stdlib/streams-node-from-iterator/lib/factory.js","../node_modules/@stdlib/streams-node-from-strided-array/lib/debug.js","../node_modules/@stdlib/streams-node-from-strided-array/lib/main.js","../node_modules/@stdlib/streams-node-from-strided-array/lib/validate.js","../node_modules/@stdlib/streams-node-from-strided-array/lib/index.js","../node_modules/@stdlib/streams-node-from-strided-array/lib/object_mode.js","../node_modules/@stdlib/streams-node-from-strided-array/lib/factory.js","../node_modules/@stdlib/streams-node-join/lib/debug.js","../node_modules/@stdlib/streams-node-join/lib/main.js","../node_modules/@stdlib/streams-node-join/lib/defaults.js","../node_modules/@stdlib/streams-node-join/lib/validate.js","../node_modules/@stdlib/streams-node-join/lib/index.js","../node_modules/@stdlib/streams-node-join/lib/object_mode.js","../node_modules/@stdlib/streams-node-join/lib/factory.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","../node_modules/@stdlib/streams-node-split/lib/debug.js","../node_modules/@stdlib/streams-node-split/lib/decode.js","../node_modules/@stdlib/streams-node-split/lib/main.js","../node_modules/@stdlib/streams-node-split/lib/validate.js","../node_modules/@stdlib/streams-node-split/lib/index.js","../node_modules/@stdlib/streams-node-split/lib/object_mode.js","../node_modules/@stdlib/streams-node-split/lib/factory.js","../node_modules/@stdlib/streams-node-stderr/lib/main.js","../node_modules/@stdlib/streams-node-stdin/lib/main.js","../node_modules/@stdlib/streams-node-stdout/lib/main.js","../node_modules/@stdlib/streams-node-transform/lib/validate.js","../node_modules/@stdlib/streams-node-transform/lib/destroy.js","../node_modules/@stdlib/streams-node-transform/lib/_transform.js","../node_modules/@stdlib/streams-node-transform/lib/main.js","../node_modules/@stdlib/streams-node-transform/lib/ctor.js","../node_modules/@stdlib/streams-node-transform/lib/index.js","../node_modules/@stdlib/streams-node-transform/lib/object_mode.js","../node_modules/@stdlib/streams-node-transform/lib/factory.js","../lib/index.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\nimport isNumber from './is_number.js';\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 {Object} token - token object\n* @throws {Error} must provide a valid floating-point number\n* @returns {string} formatted token argument\n*/\nfunction formatDouble( token ) {\n\tvar digits;\n\tvar out;\n\tvar f = parseFloat( token.arg );\n\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\tif ( !isNumber( token.arg ) ) {\n\t\t\tthrow new Error( 'invalid floating-point number. Value: ' + out );\n\t\t}\n\t\t// Case: NaN, Infinity, or -Infinity\n\t\tf = token.arg;\n\t}\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 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 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\ttoken.arg = formatDouble( 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\ttokens.push( parse( match ) );\n\t\tprev = RE.lastIndex;\n\t\tmatch = RE.exec( str );\n\t}\n\tcontent = str.slice( prev );\n\tif ( content.length ) {\n\t\ttokens.push( content );\n\t}\n\treturn tokens;\n}\n\n\n// EXPORTS //\n\nexport default formatTokenize;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport interpolate from '@stdlib/string-base-format-interpolate';\nimport tokenize from '@stdlib/string-base-format-tokenize';\nimport isString from './is_string.js';\n\n\n// MAIN //\n\n/**\n* Inserts supplied variable values into a format string.\n*\n* @param {string} str - input string\n* @param {Array} ...args - variable values\n* @throws {TypeError} first argument must be a string\n* @throws {Error} invalid flags\n* @returns {string} formatted string\n*\n* @example\n* var str = format( 'Hello %s!', 'world' );\n* // returns 'Hello world!'\n*\n* @example\n* var str = format( 'Pi: ~%.2f', 3.141592653589793 );\n* // returns 'Pi: ~3.14'\n*/\nfunction format( str ) {\n\tvar args;\n\tvar i;\n\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\targs = [ tokenize( str ) ];\n\tfor ( i = 1; i < arguments.length; i++ ) {\n\t\targs.push( arguments[ i ] );\n\t}\n\treturn interpolate.apply( null, args );\n}\n\n\n// EXPORTS //\n\nexport default format;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Tests if a value is a string primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string primitive\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns false\n*/\nfunction isString( value ) {\n\treturn ( typeof value === 'string' ); // NOTE: we inline the `isString.isPrimitive` function from `@stdlib/assert/is-string` in order to avoid circular dependencies.\n}\n\n\n// EXPORTS //\n\nexport default isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n/* eslint-disable no-underscore-dangle, no-proto */\n\n'use strict';\n\n// MODULES //\n\nimport format from '@stdlib/string-format';\n\n\n// VARIABLES //\n\nvar objectProtoype = Object.prototype;\nvar toStr = objectProtoype.toString;\nvar defineGetter = objectProtoype.__defineGetter__;\nvar defineSetter = objectProtoype.__defineSetter__;\nvar lookupGetter = objectProtoype.__lookupGetter__;\nvar lookupSetter = objectProtoype.__lookupSetter__;\n\n\n// MAIN //\n\n/**\n* Defines (or modifies) an object property.\n*\n* ## Notes\n*\n* - Property descriptors come in two flavors: **data descriptors** and **accessor descriptors**. A data descriptor is a property that has a value, which may or may not be writable. An accessor descriptor is a property described by a getter-setter function pair. A descriptor must be one of these two flavors and cannot be both.\n*\n* @param {Object} obj - object on which to define the property\n* @param {string} prop - property name\n* @param {Object} descriptor - property descriptor\n* @param {boolean} [descriptor.configurable=false] - boolean indicating if property descriptor can be changed and if the property can be deleted from the provided object\n* @param {boolean} [descriptor.enumerable=false] - boolean indicating if the property shows up when enumerating object properties\n* @param {boolean} [descriptor.writable=false] - boolean indicating if the value associated with the property can be changed with an assignment operator\n* @param {*} [descriptor.value] - property value\n* @param {(Function|void)} [descriptor.get=undefined] - function which serves as a getter for the property, or, if no getter, undefined. When the property is accessed, a getter function is called without arguments and with the `this` context set to the object through which the property is accessed (which may not be the object on which the property is defined due to inheritance). The return value will be used as the property value.\n* @param {(Function|void)} [descriptor.set=undefined] - function which serves as a setter for the property, or, if no setter, undefined. When assigning a property value, a setter function is called with one argument (the value being assigned to the property) and with the `this` context set to the object through which the property is assigned.\n* @throws {TypeError} first argument must be an object\n* @throws {TypeError} third argument must be an object\n* @throws {Error} property descriptor cannot have both a value and a setter and/or getter\n* @returns {Object} object with added property\n*\n* @example\n* var obj = {};\n*\n* defineProperty( obj, 'foo', {\n* 'value': 'bar'\n* });\n*\n* var str = obj.foo;\n* // returns 'bar'\n*/\nfunction defineProperty( obj, prop, descriptor ) {\n\tvar prototype;\n\tvar hasValue;\n\tvar hasGet;\n\tvar hasSet;\n\n\tif ( typeof obj !== 'object' || obj === null || toStr.call( obj ) === '[object Array]' ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an object. Value: `%s`.', obj ) );\n\t}\n\tif ( typeof descriptor !== 'object' || descriptor === null || toStr.call( descriptor ) === '[object Array]' ) {\n\t\tthrow new TypeError( format( 'invalid argument. Property descriptor must be an object. Value: `%s`.', descriptor ) );\n\t}\n\thasValue = ( 'value' in descriptor );\n\tif ( hasValue ) {\n\t\tif (\n\t\t\tlookupGetter.call( obj, prop ) ||\n\t\t\tlookupSetter.call( obj, prop )\n\t\t) {\n\t\t\t// Override `__proto__` to avoid touching inherited accessors:\n\t\t\tprototype = obj.__proto__;\n\t\t\tobj.__proto__ = objectProtoype;\n\n\t\t\t// Delete property as existing getters/setters prevent assigning value to specified property:\n\t\t\tdelete obj[ prop ];\n\t\t\tobj[ prop ] = descriptor.value;\n\n\t\t\t// Restore original prototype:\n\t\t\tobj.__proto__ = prototype;\n\t\t} else {\n\t\t\tobj[ prop ] = descriptor.value;\n\t\t}\n\t}\n\thasGet = ( 'get' in descriptor );\n\thasSet = ( 'set' in descriptor );\n\n\tif ( hasValue && ( hasGet || hasSet ) ) {\n\t\tthrow new Error( 'invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.' );\n\t}\n\n\tif ( hasGet && defineGetter ) {\n\t\tdefineGetter.call( obj, prop, descriptor.get );\n\t}\n\tif ( hasSet && defineSetter ) {\n\t\tdefineSetter.call( obj, prop, descriptor.set );\n\t}\n\treturn obj;\n}\n\n\n// EXPORTS //\n\nexport default defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Define (or modify) an object property.\n*\n* @module @stdlib/utils-define-property\n*\n* @example\n* import defineProperty from '@stdlib/utils-define-property';\n*\n* var obj = {};\n* defineProperty( obj, 'foo', {\n* 'value': 'bar',\n* 'writable': false,\n* 'configurable': false,\n* 'enumerable': false\n* });\n* obj.foo = 'boop'; // => throws\n*/\n\n// MODULES //\n\nimport hasDefinePropertySupport from './has_define_property_support.js';\nimport builtin from './builtin.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar defineProperty;\nif ( hasDefinePropertySupport() ) {\n\tdefineProperty = builtin;\n} else {\n\tdefineProperty = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport defineProperty from './define_property.js';\n\n\n// MAIN //\n\n/**\n* Tests for `Object.defineProperty` support.\n*\n* @private\n* @returns {boolean} boolean indicating if an environment has `Object.defineProperty` support\n*\n* @example\n* var bool = hasDefinePropertySupport();\n* // returns \n*/\nfunction hasDefinePropertySupport() {\n\t// Test basic support...\n\ttry {\n\t\tdefineProperty( {}, 'x', {} );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default hasDefinePropertySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport defineProperty from '@stdlib/utils-define-property';\n\n\n// MAIN //\n\n/**\n* Defines a 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 '@stdlib/utils-define-property';\n\n\n// MAIN //\n\n/**\n* Defines a non-enumerable read-only property.\n*\n* @param {Object} obj - object on which to define the property\n* @param {(string|symbol)} prop - property name\n* @param {*} value - value to set\n*\n* @example\n* var obj = {};\n*\n* setNonEnumerableReadOnly( obj, 'foo', 'bar' );\n*\n* try {\n* obj.foo = 'boop';\n* } catch ( err ) {\n* console.error( err.message );\n* }\n*/\nfunction setNonEnumerableReadOnly( obj, prop, value ) {\n\tdefineProperty( obj, prop, {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': false,\n\t\t'value': value\n\t});\n}\n\n\n// EXPORTS //\n\nexport default setNonEnumerableReadOnly;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\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) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport hasSymbols from '@stdlib/assert-has-symbol-support';\n\n\n// VARIABLES //\n\nvar FLG = hasSymbols();\n\n\n// MAIN //\n\n/**\n* Tests for native `toStringTag` support.\n*\n* @returns {boolean} boolean indicating if an environment has `toStringTag` support\n*\n* @example\n* var bool = hasToStringTagSupport();\n* // returns \n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\nvar Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Return a string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Returns a boolean.\n*\n* @name Boolean\n* @constructor\n* @type {Function}\n* @param {*} value - input value\n* @returns {(boolean|Boolean)} boolean\n*\n* @example\n* var b = Boolean( null );\n* // returns false\n*\n* b = Boolean( [] );\n* // returns true\n*\n* b = Boolean( {} );\n* // returns true\n*\n* @example\n* var b = new Boolean( false );\n* // returns \n*/\nvar Bool = Boolean; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// eslint-disable-next-line stdlib/no-redeclare\nvar toString = Boolean.prototype.toString; // non-generic\n\n\n// EXPORTS //\n\nexport default toString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport nativeClass from '@stdlib/utils-native-class';\nimport Boolean from '@stdlib/boolean-ctor';\nimport test from './try2serialize.js';\n\n\n// VARIABLES //\n\nvar FLG = hasToStringTag();\n\n\n// MAIN //\n\n/**\n* Tests if a value is a boolean object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a boolean object\n*\n* @example\n* var bool = isBoolean( true );\n* // returns false\n*\n* @example\n* import Boolean from '@stdlib/boolean-ctor';\n*\n* var bool = isBoolean( new Boolean( false ) );\n* // returns true\n*/\nfunction isBoolean( value ) {\n\tif ( typeof value === 'object' ) {\n\t\tif ( value instanceof Boolean ) {\n\t\t\treturn true;\n\t\t}\n\t\tif ( FLG ) {\n\t\t\treturn test( value );\n\t\t}\n\t\treturn ( nativeClass( value ) === '[object Boolean]' );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nexport default isBoolean;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport toString from './tostring.js'; // eslint-disable-line stdlib/no-redeclare\n\n\n// MAIN //\n\n/**\n* Attempts to serialize a value to a string.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value can be serialized\n*/\nfunction test( value ) {\n\ttry {\n\t\ttoString.call( value );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isPrimitive from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a boolean.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a boolean\n*\n* @example\n* var bool = isBoolean( false );\n* // returns true\n*\n* @example\n* var bool = isBoolean( true );\n* // returns true\n*\n* @example\n* import Boolean from '@stdlib/boolean-ctor';\n*\n* var bool = isBoolean( new Boolean( false ) );\n* // returns true\n*\n* @example\n* import Boolean from '@stdlib/boolean-ctor';\n*\n* var bool = isBoolean( new Boolean( true ) );\n* // returns true\n*/\nfunction isBoolean( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nexport default isBoolean;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Test if a value is a boolean.\n*\n* @module @stdlib/assert-is-boolean\n*\n* @example\n* import Boolean from '@stdlib/boolean-ctor';\n* import isBoolean from '@stdlib/assert-is-boolean';\n*\n* var bool = isBoolean( false );\n* // returns true\n*\n* bool = isBoolean( new Boolean( false ) );\n* // returns true\n*\n* @example\n* import Boolean from '@stdlib/boolean-ctor';\n* import { isPrimitive as isBoolean } from '@stdlib/assert-is-boolean';\n*\n* var bool = isBoolean( false );\n* // returns true\n*\n* bool = isBoolean( new Boolean( true ) );\n* // returns false\n*\n* @example\n* import Boolean from '@stdlib/boolean-ctor';\n* import { isObject as isBoolean } from '@stdlib/assert-is-boolean';\n*\n* var bool = isBoolean( true );\n* // returns false\n*\n* bool = isBoolean( new Boolean( false ) );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport isPrimitive from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'isPrimitive', isPrimitive );\nsetReadOnly( main, 'isObject', isObject );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\nvar obj = ( typeof self === 'object' ) ? self : null;\n\n\n// EXPORTS //\n\nexport default obj;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\nvar obj = ( typeof window === 'object' ) ? window : null;\n\n\n// EXPORTS //\n\nexport default obj;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\nvar obj = ( typeof global === 'object' ) ? global : null;\n\n\n// EXPORTS //\n\nexport default obj;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\nvar obj = ( typeof globalThis === 'object' ) ? globalThis : null; // eslint-disable-line no-undef\n\n\n// EXPORTS //\n\nexport default obj;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { 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\n// MODULES //\n\nimport getGlobal from '@stdlib/utils-global';\n\n\n// MAIN //\n\nvar root = getGlobal();\nvar nodeList = root.document && root.document.childNodes;\n\n\n// EXPORTS //\n\nexport default nodeList;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\nvar typedarray = Int8Array; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default typedarray;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Returns a regular expression to capture everything that is not a space immediately after the `function` keyword and before the first left parenthesis.\n*\n* @returns {RegExp} regular expression\n*\n* @example\n* var RE_FUNCTION_NAME = reFunctionName();\n*\n* function fname( fcn ) {\n* return RE_FUNCTION_NAME.exec( fcn.toString() )[ 1 ];\n* }\n*\n* var fn = fname( Math.sqrt );\n* // returns 'sqrt'\n*\n* fn = fname( Int8Array );\n* // returns 'Int8Array'\n*\n* fn = fname( Object.prototype.toString );\n* // returns 'toString'\n*\n* fn = fname( function(){} );\n* // returns ''\n*/\nfunction reFunctionName() {\n\treturn /^\\s*function\\s*([^(]*)/i;\n}\n\n\n// EXPORTS //\n\nexport default reFunctionName;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport reFunctionName from './main.js';\n\n\n// MAIN //\n\n/**\n* Captures everything that is not a space immediately after the `function` keyword and before the first left parenthesis.\n*\n* Regular expression: `/^\\s*function\\s*([^(]*)/i`\n*\n* - `/^\\s*`\n* - Match zero or more spaces at beginning\n*\n* - `function`\n* - Match the word `function`\n*\n* - `\\s*`\n* - Match zero or more spaces after the word `function`\n*\n* - `()`\n* - Capture\n*\n* - `[^(]*`\n* - Match anything except a left parenthesis `(` zero or more times\n*\n* - `/i`\n* - ignore case\n*\n* @constant\n* @type {RegExp}\n* @default /^\\s*function\\s*([^(]*)/i\n*/\nvar RE_FUNCTION_NAME = reFunctionName();\n\n\n// EXPORTS //\n\nexport default RE_FUNCTION_NAME;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport 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) 2021 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Regular expression to capture everything that is not a space immediately after the `function` keyword and before the first left parenthesis.\n*\n* @module @stdlib/regexp-function-name\n*\n* @example\n* import reFunctionName from '@stdlib/regexp-function-name';\n* var RE_FUNCTION_NAME = reFunctionName();\n*\n* function fname( fcn ) {\n* return RE_FUNCTION_NAME.exec( fcn.toString() )[ 1 ];\n* }\n*\n* var fn = fname( Math.sqrt );\n* // returns 'sqrt'\n*\n* fn = fname( Int8Array );\n* // returns 'Int8Array'\n*\n* fn = fname( Object.prototype.toString );\n* // returns 'toString'\n*\n* fn = fname( function(){} );\n* // returns ''\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport REGEXP from './regexp.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'REGEXP', REGEXP );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* 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/**\n* Test if a value is object-like.\n*\n* @module @stdlib/assert-is-object-like\n*\n* @example\n* import isObjectLike from '@stdlib/assert-is-object-like';\n*\n* var bool = isObjectLike( {} );\n* // returns true\n*\n* bool = isObjectLike( [] );\n* // returns true\n*\n* bool = isObjectLike( null );\n* // returns false\n*\n* @example\n* import { isObjectLikeArray as isObjectLike } from '@stdlib/assert-is-object-like';\n*\n* var bool = isObjectLike( [ {}, [] ] );\n* // returns true\n*\n* bool = isObjectLike( [ {}, '3.0' ] );\n* // returns false\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport arrayfun from '@stdlib/assert-tools-array-function';\nimport main from './main.js';\n\n\n// VARIABLES //\n\nvar isObjectLikeArray = arrayfun( main );\n\n\n// MAIN //\n\nsetReadOnly( main, 'isObjectLikeArray', isObjectLikeArray );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isArray from '@stdlib/assert-is-array';\nimport format from '@stdlib/string-format';\n\n\n// MAIN //\n\n/**\n* Returns a function which tests if every element in an array passes a test condition.\n*\n* @param {Function} predicate - function to apply\n* @throws {TypeError} must provide a function\n* @returns {Function} an array function\n*\n* @example\n* import isOdd from '@stdlib/assert-is-odd';\n*\n* var arr1 = [ 1, 3, 5, 7 ];\n* var arr2 = [ 3, 5, 8 ];\n*\n* var validate = arrayfcn( isOdd );\n*\n* var bool = validate( arr1 );\n* // returns true\n*\n* bool = validate( arr2 );\n* // returns false\n*/\nfunction arrayfcn( predicate ) {\n\tif ( typeof predicate !== 'function' ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a function. Value: `%s`.', predicate ) );\n\t}\n\treturn every;\n\n\t/**\n\t* Tests if every element in an array passes a test condition.\n\t*\n\t* @private\n\t* @param {*} value - value to test\n\t* @returns {boolean} boolean indicating whether a value is an array for which all elements pass a test condition\n\t*/\n\tfunction every( value ) {\n\t\tvar len;\n\t\tvar i;\n\t\tif ( !isArray( value ) ) {\n\t\t\treturn false;\n\t\t}\n\t\tlen = value.length;\n\t\tif ( len === 0 ) {\n\t\t\treturn false;\n\t\t}\n\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\tif ( predicate( value[ i ] ) === false ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default arrayfcn;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isObjectLike from '@stdlib/assert-is-object-like';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Buffer instance.\n*\n* @param {*} value - value to validate\n* @returns {boolean} boolean indicating if a value is a Buffer instance\n*\n* @example\n* var v = isBuffer( new Buffer( 'beep' ) );\n* // returns true\n*\n* @example\n* var v = isBuffer( new Buffer( [1,2,3,4] ) );\n* // returns true\n*\n* @example\n* var v = isBuffer( {} );\n* // returns false\n*\n* @example\n* var v = isBuffer( [] );\n* // returns false\n*/\nfunction isBuffer( value ) {\n\treturn (\n\t\tisObjectLike( value ) &&\n\t\t(\n\t\t\t// eslint-disable-next-line no-underscore-dangle\n\t\t\tvalue._isBuffer || // for envs missing Object.prototype.constructor (e.g., Safari 5-7)\n\t\t\t(\n\t\t\t\tvalue.constructor &&\n\n\t\t\t\t// WARNING: `typeof` is not a foolproof check, as certain envs consider RegExp and NodeList instances to be functions\n\t\t\t\ttypeof value.constructor.isBuffer === 'function' &&\n\t\t\t\tvalue.constructor.isBuffer( value )\n\t\t\t)\n\t\t)\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isBuffer;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\nimport { REGEXP as RE } from '@stdlib/regexp-function-name';\nimport isBuffer from '@stdlib/assert-is-buffer';\n\n\n// MAIN //\n\n/**\n* Determines the name of a value's constructor.\n*\n* @param {*} v - input value\n* @returns {string} name of a value's constructor\n*\n* @example\n* var v = constructorName( 'a' );\n* // returns 'String'\n*\n* @example\n* var v = constructorName( 5 );\n* // returns 'Number'\n*\n* @example\n* var v = constructorName( null );\n* // returns 'Null'\n*\n* @example\n* var v = constructorName( undefined );\n* // returns 'Undefined'\n*\n* @example\n* var v = constructorName( function noop() {} );\n* // returns 'Function'\n*/\nfunction constructorName( v ) {\n\tvar match;\n\tvar name;\n\tvar ctor;\n\tname = nativeClass( v ).slice( 8, -1 );\n\tif ( (name === 'Object' || name === 'Error') && v.constructor ) {\n\t\tctor = v.constructor;\n\t\tif ( typeof ctor.name === 'string' ) {\n\t\t\treturn ctor.name;\n\t\t}\n\t\tmatch = RE.exec( ctor.toString() );\n\t\tif ( match ) {\n\t\t\treturn match[ 1 ];\n\t\t}\n\t}\n\tif ( isBuffer( v ) ) {\n\t\treturn 'Buffer';\n\t}\n\treturn name;\n}\n\n\n// EXPORTS //\n\nexport default constructorName;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Determine a value's type.\n*\n* @module @stdlib/utils-type-of\n*\n* @example\n* import typeOf from '@stdlib/utils-type-of';\n*\n* var str = typeOf( 'a' );\n* // returns 'string'\n*\n* str = typeOf( 5 );\n* // returns 'number'\n*/\n\n// MODULES //\n\nimport usePolyfill from './check.js';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main = ( usePolyfill() ) ? polyfill : builtin;\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport RE from './fixtures/re.js';\nimport nodeList from './fixtures/nodelist.js';\nimport typedarray from './fixtures/typedarray.js';\n\n\n// MAIN //\n\n/**\n* Checks whether a polyfill is needed when using the `typeof` operator.\n*\n* @private\n* @returns {boolean} boolean indicating whether a polyfill is needed\n*/\nfunction check() {\n\tif (\n\t\t// Chrome 1-12 returns 'function' for regular expression instances (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof):\n\t\ttypeof RE === 'function' ||\n\n\t\t// Safari 8 returns 'object' for typed array and weak map constructors (underscore #1929):\n\t\ttypeof typedarray === 'object' ||\n\n\t\t// PhantomJS 1.9 returns 'function' for `NodeList` instances (underscore #2236):\n\t\ttypeof nodeList === 'function'\n\t) {\n\t\treturn true;\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nexport default check;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport ctorName from '@stdlib/utils-constructor-name';\n\n\n// MAIN //\n\n/**\n* Determines a value's type.\n*\n* @param {*} v - input value\n* @returns {string} string indicating the value's type\n*/\nfunction typeOf( v ) {\n\treturn ctorName( v ).toLowerCase();\n}\n\n\n// EXPORTS //\n\nexport default typeOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport ctorName from '@stdlib/utils-constructor-name';\n\n\n// NOTES //\n\n/*\n* Built-in `typeof` operator behavior:\n*\n* ```text\n* typeof null => 'object'\n* typeof undefined => 'undefined'\n* typeof 'a' => 'string'\n* typeof 5 => 'number'\n* typeof NaN => 'number'\n* typeof true => 'boolean'\n* typeof false => 'boolean'\n* typeof {} => 'object'\n* typeof [] => 'object'\n* typeof function foo(){} => 'function'\n* typeof function* foo(){} => 'object'\n* typeof Symbol() => 'symbol'\n* ```\n*\n*/\n\n\n// MAIN //\n\n/**\n* Determines a value's type.\n*\n* @param {*} v - input value\n* @returns {string} string indicating the value's type\n*/\nfunction typeOf( v ) {\n\tvar type;\n\n\t// Address `typeof null` => `object` (see http://wiki.ecmascript.org/doku.php?id=harmony:typeof_null):\n\tif ( v === null ) {\n\t\treturn 'null';\n\t}\n\ttype = typeof v;\n\n\t// If the `typeof` operator returned something other than `object`, we are done. Otherwise, we need to check for an internal class name or search for a constructor.\n\tif ( type === 'object' ) {\n\t\treturn ctorName( v ).toLowerCase();\n\t}\n\treturn type;\n}\n\n\n// EXPORTS //\n\nexport default typeOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport typeOf from '@stdlib/utils-type-of';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a function.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a function\n*\n* @example\n* function beep() {\n* return 'beep';\n* }\n*\n* var bool = isFunction( beep );\n* // returns true\n*/\nfunction isFunction( value ) {\n\t// Note: cannot use `typeof` directly, as various browser engines incorrectly return `'function'` when operating on non-function objects, such as regular expressions and NodeLists.\n\treturn ( typeOf( value ) === 'function' );\n}\n\n\n// EXPORTS //\n\nexport default isFunction;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 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';\n\n\n// MAIN //\n\nvar bool = isFunction( Object.assign ); // eslint-disable-line node/no-unsupported-features/es-builtins\n\n\n// EXPORTS //\n\nexport default bool;\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* Copies own enumerable properties from source objects to a target object.\n*\n* ## Notes\n*\n* - If a property key is present in multiple sources, the property from the last source that defines the key prevails.\n* - The target object is mutated.\n*\n* @name assign\n* @type {Function}\n* @param {Object} target - target object\n* @param {...Object} source - source object(s)\n* @throws {TypeError} first argument must not be null or undefined\n* @returns {Object} target object\n*\n* @example\n* var obj1 = {\n* 'a': 'beep'\n* };\n* var obj2 = {\n* 'b': 'boop'\n* };\n*\n* var out = assign( obj1, obj2 );\n* // returns { 'a': 'beep', 'b': 'boop' }\n*/\nvar assign = Object.assign; // eslint-disable-line node/no-unsupported-features/es-builtins\n\n\n// EXPORTS //\n\nexport default assign;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 array of an object's own enumerable property names.\n*\n* ## Notes\n*\n* - In contrast to the built-in `Object.keys()`, this function returns an empty array if provided `undefined` or `null`, rather than throwing an error.\n*\n* @private\n* @param {*} value - input object\n* @returns {Array} a list of own enumerable property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var k = keys( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nfunction keys( value ) {\n\treturn Object.keys( Object( value ) );\n}\n\n\n// EXPORTS //\n\nexport default keys;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 Object.keys !== 'undefined' );\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 isArguments from './main.js';\n\n\n// VARIABLES //\n\nvar bool;\n\n\n// FUNCTIONS //\n\n/**\n* Detects whether an environment returns the expected internal class of the `arguments` object.\n*\n* @private\n* @returns {boolean} boolean indicating whether an environment behaves as expected\n*\n* @example\n* var bool = detect();\n* // returns \n*/\nfunction detect() {\n\treturn isArguments( arguments );\n}\n\n\n// MAIN //\n\nbool = detect();\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 nativeClass from '@stdlib/utils-native-class';\n\n\n// MAIN //\n\n/**\n* Tests whether a value is an `arguments` object.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is an `arguments` object\n*\n* @example\n* function foo() {\n* return arguments;\n* }\n*\n* var bool = isArguments( foo() );\n* // returns true\n*\n* @example\n* var bool = isArguments( [] );\n* // returns false\n*/\nfunction isArguments( value ) {\n\treturn ( nativeClass( value ) === '[object Arguments]' );\n}\n\n\n// EXPORTS //\n\nexport default isArguments;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Tests if a value is a string primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string primitive\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns false\n*/\nfunction isString( value ) {\n\treturn ( typeof value === 'string' );\n}\n\n\n// EXPORTS //\n\nexport default isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// eslint-disable-next-line stdlib/no-redeclare\nvar valueOf = String.prototype.valueOf; // non-generic\n\n\n// EXPORTS //\n\nexport default valueOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport nativeClass from '@stdlib/utils-native-class';\nimport test from './try2valueof.js';\n\n\n// VARIABLES //\n\nvar FLG = hasToStringTag();\n\n\n// MAIN //\n\n/**\n* Tests if a value is a string object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string object\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns true\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns false\n*/\nfunction isString( value ) {\n\tif ( typeof value === 'object' ) {\n\t\tif ( value instanceof String ) {\n\t\t\treturn true;\n\t\t}\n\t\tif ( FLG ) {\n\t\t\treturn test( value );\n\t\t}\n\t\treturn ( nativeClass( value ) === '[object String]' );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nexport default isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport valueOf from './valueof.js'; // eslint-disable-line stdlib/no-redeclare\n\n\n// MAIN //\n\n/**\n* Attempts to extract a string value.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a string can be extracted\n*/\nfunction test( value ) {\n\ttry {\n\t\tvalueOf.call( value );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isPrimitive from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a string.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a string\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns true\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*/\nfunction isString( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nexport default isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* 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/**\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// EXPORTS //\n\nexport default Number; // eslint-disable-line stdlib/require-globals\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Number from '@stdlib/number-ctor';\n\n\n// MAIN //\n\n// eslint-disable-next-line stdlib/no-redeclare\nvar toString = Number.prototype.toString; // non-generic\n\n\n// EXPORTS //\n\nexport default toString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport nativeClass from '@stdlib/utils-native-class';\nimport Number from '@stdlib/number-ctor';\nimport test from './try2serialize.js';\n\n\n// VARIABLES //\n\nvar FLG = hasToStringTag();\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object\n*\n* @example\n* var bool = isNumber( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isNumber( new Number( 3.14 ) );\n* // returns true\n*/\nfunction isNumber( value ) {\n\tif ( typeof value === 'object' ) {\n\t\tif ( value instanceof Number ) {\n\t\t\treturn true;\n\t\t}\n\t\tif ( FLG ) {\n\t\t\treturn test( value );\n\t\t}\n\t\treturn ( nativeClass( value ) === '[object Number]' );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nexport default isNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport toString from './tostring.js'; // eslint-disable-line stdlib/no-redeclare\n\n\n// MAIN //\n\n/**\n* Attempts to serialize a value to a string.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value can be serialized\n*/\nfunction test( value ) {\n\ttry {\n\t\ttoString.call( value );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isPrimitive from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a number\n*\n* @example\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* @example\n* var bool = isNumber( new Number( 3.14 ) );\n* // returns true\n*\n* @example\n* var bool = isNumber( NaN );\n* // returns true\n*\n* @example\n* var bool = isNumber( null );\n* // returns false\n*/\nfunction isNumber( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nexport default isNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// 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 { isPrimitive as isNumber } from '@stdlib/assert-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 '@stdlib/assert-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 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* 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) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Double-precision floating-point positive infinity.\n*\n* @module @stdlib/constants-float64-pinf\n* @type {number}\n*\n* @example\n* import FLOAT64_PINF from '@stdlib/constants-float64-pinf';\n* // returns Infinity\n*/\n\n\n// MAIN //\n\n/**\n* Double-precision floating-point positive infinity.\n*\n* ## Notes\n*\n* Double-precision floating-point positive infinity has the bit sequence\n*\n* ```binarystring\n* 0 11111111111 00000000000000000000 00000000000000000000000000000000\n* ```\n*\n* @constant\n* @type {number}\n* @default Number.POSITIVE_INFINITY\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT64_PINF = Number.POSITIVE_INFINITY; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default FLOAT64_PINF;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Double-precision floating-point negative infinity.\n*\n* @module @stdlib/constants-float64-ninf\n* @type {number}\n*\n* @example\n* import FLOAT64_NINF from '@stdlib/constants-float64-ninf';\n* // returns -Infinity\n*/\n\n// MODULES //\n\nimport Number from '@stdlib/number-ctor';\n\n\n// MAIN //\n\n/**\n* Double-precision floating-point negative infinity.\n*\n* ## Notes\n*\n* Double-precision floating-point negative infinity has the bit sequence\n*\n* ```binarystring\n* 1 11111111111 00000000000000000000 00000000000000000000000000000000\n* ```\n*\n* @constant\n* @type {number}\n* @default Number.NEGATIVE_INFINITY\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT64_NINF = Number.NEGATIVE_INFINITY;\n\n\n// EXPORTS //\n\nexport default FLOAT64_NINF;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// TODO: implementation (?)\n\n/**\n* Rounds a double-precision floating-point number toward negative infinity.\n*\n* @param {number} x - input value\n* @returns {number} rounded value\n*\n* @example\n* var v = floor( -4.2 );\n* // returns -5.0\n*\n* @example\n* var v = floor( 9.99999 );\n* // returns 9.0\n*\n* @example\n* var v = floor( 0.0 );\n* // returns 0.0\n*\n* @example\n* var v = floor( NaN );\n* // returns NaN\n*/\nvar floor = Math.floor; // eslint-disable-line stdlib/no-builtin-math\n\n\n// EXPORTS //\n\nexport default floor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport floor from '@stdlib/math-base-special-floor';\n\n\n// MAIN //\n\n/**\n* Tests if a finite double-precision floating-point number is an integer.\n*\n* @param {number} x - value to test\n* @returns {boolean} boolean indicating whether the value is an integer\n*\n* @example\n* var bool = isInteger( 1.0 );\n* // returns true\n*\n* @example\n* var bool = isInteger( 3.14 );\n* // returns false\n*/\nfunction isInteger( x ) {\n\treturn (floor(x) === x);\n}\n\n\n// EXPORTS //\n\nexport default isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport PINF from '@stdlib/constants-float64-pinf';\nimport NINF from '@stdlib/constants-float64-ninf';\nimport isInt from '@stdlib/math-base-assert-is-integer';\n\n\n// MAIN //\n\n/**\n* Tests if a number primitive is an integer value.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a number primitive is an integer value\n*/\nfunction isInteger( value ) {\n\treturn (\n\t\tvalue < PINF &&\n\t\tvalue > NINF &&\n\t\tisInt( value )\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isNumber } from '@stdlib/assert-is-number';\nimport isInt from './integer.js';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number primitive having an integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number primitive having an integer value\n*\n* @example\n* var bool = isInteger( -3.0 );\n* // returns true\n*\n* @example\n* var bool = isInteger( new Number( -3.0 ) );\n* // returns false\n*/\nfunction isInteger( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tisInt( value )\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isObject as isNumber } from '@stdlib/assert-is-number';\nimport isInt from './integer.js';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object having an integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object having an integer value\n*\n* @example\n* var bool = isInteger( 3.0 );\n* // returns false\n*\n* @example\n* var bool = isInteger( new Number( 3.0 ) );\n* // returns true\n*/\nfunction isInteger( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tisInt( value.valueOf() )\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isPrimitive from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\n/**\n* Tests if a value is an integer.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an integer\n*\n* @example\n* var bool = isInteger( 5.0 );\n* // returns true\n*\n* @example\n* var bool = isInteger( new Number( 5.0 ) );\n* // returns true\n*\n* @example\n* var bool = isInteger( -3.14 );\n* // returns false\n*\n* @example\n* var bool = isInteger( null );\n* // returns false\n*/\nfunction isInteger( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nexport default isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\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// MAIN //\n\n/**\n* Tests if an object's own property is enumerable.\n*\n* @private\n* @name isEnumerableProperty\n* @type {Function}\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object property is enumerable\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = isEnumerableProperty( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = isEnumerableProperty( beep, 'hasOwnProperty' );\n* // returns false\n*/\nvar isEnumerableProperty = Object.prototype.propertyIsEnumerable;\n\n\n// EXPORTS //\n\nexport default isEnumerableProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isEnum from './native.js';\n\n\n// VARIABLES //\n\nvar bool;\n\n\n// FUNCTIONS //\n\n/**\n* Detects whether an environment has a bug where String indices are not detected as \"enumerable\" properties. Observed in Node v0.10.\n*\n* @private\n* @returns {boolean} boolean indicating whether an environment has the bug\n*/\nfunction detect() {\n\treturn !isEnum.call( 'beep', '0' );\n}\n\n\n// MAIN //\n\nbool = detect();\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 isString from '@stdlib/assert-is-string';\nimport { isPrimitive as isnan } from '@stdlib/assert-is-nan';\nimport { isPrimitive as isInteger } from '@stdlib/assert-is-integer';\nimport isEnum from './native.js';\nimport hasStringEnumBug from './has_string_enumerability_bug.js';\n\n\n// MAIN //\n\n/**\n* Tests if an object's own property is enumerable.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object property is enumerable\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = isEnumerableProperty( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = isEnumerableProperty( beep, 'hasOwnProperty' );\n* // returns false\n*/\nfunction isEnumerableProperty( value, property ) {\n\tvar bool;\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\tbool = isEnum.call( value, property );\n\tif ( !bool && hasStringEnumBug && isString( value ) ) {\n\t\t// Note: we only check for indices, as properties attached to a `String` object are properly detected as enumerable above.\n\t\tproperty = +property;\n\t\treturn (\n\t\t\t!isnan( property ) &&\n\t\t\tisInteger( property ) &&\n\t\t\tproperty >= 0 &&\n\t\t\tproperty < value.length\n\t\t);\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default isEnumerableProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\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* Test if a value is an `arguments` object.\n*\n* @module @stdlib/assert-is-arguments\n*\n* @example\n* import isArguments from '@stdlib/assert-is-arguments';\n*\n* function foo() {\n* return arguments;\n* }\n*\n* var bool = isArguments( foo() );\n* // returns true\n*\n* bool = isArguments( [] );\n* // returns false\n*/\n\n// MODULES //\n\nimport hasArgumentsClass from './detect.js';\nimport main from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar isArguments;\nif ( hasArgumentsClass ) {\n\tisArguments = main;\n} else {\n\tisArguments = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default isArguments;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isEnumerableProperty from '@stdlib/assert-is-enumerable-property';\nimport isArray from '@stdlib/assert-is-array';\nimport isInteger from '@stdlib/math-base-assert-is-integer';\nimport MAX_LENGTH from '@stdlib/constants-uint32-max';\n\n\n// MAIN //\n\n/**\n* Tests whether a value is an `arguments` object.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is an `arguments` object\n*\n* @example\n* function foo() {\n* return arguments;\n* }\n*\n* var bool = isArguments( foo() );\n* // returns true\n*\n* @example\n* var bool = isArguments( [] );\n* // returns false\n*/\nfunction isArguments( value ) {\n\treturn (\n\t\tvalue !== null &&\n\t\ttypeof value === 'object' &&\n\t\t!isArray( value ) &&\n\t\ttypeof value.length === 'number' &&\n\t\tisInteger( value.length ) &&\n\t\tvalue.length >= 0 &&\n\t\tvalue.length <= MAX_LENGTH &&\n\t\thasOwnProp( value, 'callee' ) &&\n\t\t!isEnumerableProperty( value, 'callee' )\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isArguments;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isArguments from '@stdlib/assert-is-arguments';\nimport builtin from './builtin.js';\n\n\n// VARIABLES //\n\nvar slice = Array.prototype.slice;\n\n\n// MAIN //\n\n/**\n* Returns an array of an object's own enumerable property names.\n*\n* @private\n* @param {*} value - input object\n* @returns {Array} a list of own enumerable property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var k = keys( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nfunction keys( value ) {\n\tif ( isArguments( value ) ) {\n\t\treturn builtin( slice.call( value ) );\n\t}\n\treturn builtin( value );\n}\n\n\n// EXPORTS //\n\nexport default keys;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isEnumerableProperty from '@stdlib/assert-is-enumerable-property';\nimport noop from '@stdlib/utils-noop';\n\n\n// MAIN //\n\n// Note: certain environments treat an object's prototype as enumerable, which, as a matter of convention, it shouldn't be...\nvar bool = isEnumerableProperty( noop, 'prototype' );\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/**\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// MODULES //\n\nimport isEnumerableProperty from '@stdlib/assert-is-enumerable-property';\n\n\n// VARIABLES //\n\nvar obj = {\n\t'toString': null\n};\n\n\n// MAIN //\n\n// Note: certain environments don't allow enumeration of overwritten properties which are considered non-enumerable...\nvar bool = !isEnumerableProperty( obj, 'toString' );\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/**\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 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) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 whether a value equals the prototype of its constructor.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value equals the prototype of its constructor\n*/\nfunction isConstructorPrototype( value ) {\n\treturn ( value.constructor && value.constructor.prototype === value );\n}\n\n\n// EXPORTS //\n\nexport default isConstructorPrototype;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 w = ( typeof window === 'undefined' ) ? void 0 : window;\n\n\n// EXPORTS //\n\nexport default w;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 indexOf from '@stdlib/utils-index-of';\nimport typeOf from '@stdlib/utils-type-of';\nimport isConstructorPrototype from './is_constructor_prototype.js';\nimport EXCLUDED_KEYS from './excluded_keys.json';\nimport win from './window.js';\n\n\n// VARIABLES //\n\nvar bool;\n\n\n// FUNCTIONS //\n\n/**\n* Determines whether an environment throws when comparing to the prototype of a value's constructor (e.g., [IE9][1]).\n*\n* [1]: https://stackoverflow.com/questions/7688070/why-is-comparing-the-constructor-property-of-two-windows-unreliable\n*\n* @private\n* @returns {boolean} boolean indicating whether an environment is buggy\n*/\nfunction check() {\n\tvar k;\n\tif ( typeOf( win ) === 'undefined' ) {\n\t\treturn false;\n\t}\n\tfor ( k in win ) { // eslint-disable-line guard-for-in\n\t\ttry {\n\t\t\tif (\n\t\t\t\tindexOf( EXCLUDED_KEYS, k ) === -1 &&\n\t\t\t\thasOwnProp( win, k ) &&\n\t\t\t\twin[ k ] !== null &&\n\t\t\t\ttypeOf( win[ k ] ) === 'object'\n\t\t\t) {\n\t\t\t\tisConstructorPrototype( win[ k ] );\n\t\t\t}\n\t\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\n\n// MAIN //\n\nbool = check();\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// MAIN //\n\nvar bool = ( typeof window !== 'undefined' );\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 hasArgumentsBug from './has_arguments_bug.js';\nimport HAS_BUILTIN from './has_builtin.js';\nimport builtin from './builtin.js';\nimport wrapper from './builtin_wrapper.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\n/**\n* Returns an array of an object's own enumerable property names.\n*\n* @name keys\n* @type {Function}\n* @param {*} value - input object\n* @returns {Array} a list of own enumerable property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var k = keys( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nvar keys;\nif ( HAS_BUILTIN ) {\n\tif ( hasArgumentsBug() ) {\n\t\tkeys = wrapper;\n\t} else {\n\t\tkeys = builtin;\n\t}\n} else {\n\tkeys = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default keys;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport keys from './builtin.js';\n\n\n// FUNCTIONS //\n\n/**\n* Tests the built-in `Object.keys()` implementation when provided `arguments`.\n*\n* @private\n* @returns {boolean} boolean indicating whether the built-in implementation returns the expected number of keys\n*/\nfunction test() {\n\treturn ( keys( arguments ) || '' ).length !== 2;\n}\n\n\n// MAIN //\n\n/**\n* Tests whether the built-in `Object.keys()` implementation supports providing `arguments` as an input value.\n*\n* ## Notes\n*\n* - Safari 5.0 does **not** support `arguments` as an input value.\n*\n* @private\n* @returns {boolean} boolean indicating whether a built-in implementation supports `arguments`\n*/\nfunction check() {\n\treturn test( 1, 2 );\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 isObjectLike from '@stdlib/assert-is-object-like';\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport isArguments from '@stdlib/assert-is-arguments';\nimport HAS_ENUM_PROTO_BUG from './has_enumerable_prototype_bug.js';\nimport HAS_NON_ENUM_PROPS_BUG from './has_non_enumerable_properties_bug.js';\nimport isConstructorPrototype from './is_constructor_prototype_wrapper.js';\nimport NON_ENUMERABLE from './non_enumerable.json';\n\n\n// MAIN //\n\n/**\n* Returns an array of an object's own enumerable property names.\n*\n* @private\n* @param {*} value - input object\n* @returns {Array} a list of own enumerable property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var k = keys( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nfunction keys( value ) {\n\tvar skipConstructor;\n\tvar skipPrototype;\n\tvar isFcn;\n\tvar out;\n\tvar k;\n\tvar p;\n\tvar i;\n\n\tout = [];\n\tif ( isArguments( value ) ) {\n\t\t// Account for environments which treat `arguments` differently...\n\t\tfor ( i = 0; i < value.length; i++ ) {\n\t\t\tout.push( i.toString() );\n\t\t}\n\t\t// Note: yes, we are precluding the `arguments` array-like object from having other enumerable properties; however, this should (1) be very rare and (2) not be encouraged (e.g., doing something like `arguments.a = 'b'`; in certain engines directly manipulating the `arguments` value results in automatic de-optimization).\n\t\treturn out;\n\t}\n\tif ( typeof value === 'string' ) {\n\t\t// Account for environments which do not treat string character indices as \"own\" properties...\n\t\tif ( value.length > 0 && !hasOwnProp( value, '0' ) ) {\n\t\t\tfor ( i = 0; i < value.length; i++ ) {\n\t\t\t\tout.push( i.toString() );\n\t\t\t}\n\t\t}\n\t} else {\n\t\tisFcn = ( typeof value === 'function' );\n\t\tif ( isFcn === false && !isObjectLike( value ) ) {\n\t\t\treturn out;\n\t\t}\n\t\tskipPrototype = ( HAS_ENUM_PROTO_BUG && isFcn );\n\t}\n\tfor ( k in value ) {\n\t\tif ( !( skipPrototype && k === 'prototype' ) && hasOwnProp( value, k ) ) {\n\t\t\tout.push( String( k ) );\n\t\t}\n\t}\n\tif ( HAS_NON_ENUM_PROPS_BUG ) {\n\t\tskipConstructor = isConstructorPrototype( value );\n\t\tfor ( i = 0; i < NON_ENUMERABLE.length; i++ ) {\n\t\t\tp = NON_ENUMERABLE[ i ];\n\t\t\tif ( !( skipConstructor && p === 'constructor' ) && hasOwnProp( value, p ) ) {\n\t\t\t\tout.push( String( p ) );\n\t\t\t}\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default keys;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport hasAutomationEqualityBug from './has_automation_equality_bug.js';\nimport isConstructorPrototype from './is_constructor_prototype.js';\nimport HAS_WINDOW from './has_window.js';\n\n\n// MAIN //\n\n/**\n* Wraps the test for constructor prototype equality to accommodate buggy environments (e.g., environments which throw when testing equality).\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value equals the prototype of its constructor\n*/\nfunction wrapper( value ) {\n\tif ( HAS_WINDOW === false && !hasAutomationEqualityBug ) {\n\t\treturn isConstructorPrototype( value );\n\t}\n\ttry {\n\t\treturn isConstructorPrototype( value );\n\t} catch ( error ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default wrapper;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\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 an array of an object's own symbol properties.\n*\n* @module @stdlib/utils-property-symbols\n*\n* @example\n* import getOwnPropertySymbols from '@stdlib/utils-property-symbols';\n*\n* var symbols = getOwnPropertySymbols( {} );\n*/\n\n// MODULES //\n\nimport HAS_BUILTIN from './has_builtin.js';\nimport builtin from './builtin.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( HAS_BUILTIN ) {\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// MAIN //\n\nvar bool = ( typeof Object.getOwnPropertySymbols !== '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\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 Object from '@stdlib/object-ctor';\n\n\n// VARIABLES //\n\nvar propertySymbols = Object.getOwnPropertySymbols;\n\n\n// MAIN //\n\n/**\n* Returns an array of an object's own symbol properties.\n*\n* ## Notes\n*\n* - In contrast to the built-in `Object.getOwnPropertySymbols()`, this function returns an empty array if provided `undefined` or `null`, rather than throwing an error.\n*\n* @private\n* @param {*} value - input object\n* @returns {Array} a list of own symbol properties\n*\n* @example\n* var symbols = getOwnPropertySymbols( {} );\n*/\nfunction getOwnPropertySymbols( value ) {\n\treturn propertySymbols( Object( value ) );\n}\n\n\n// EXPORTS //\n\nexport default getOwnPropertySymbols;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 array of an object's own symbol properties.\n*\n* ## Notes\n*\n* - In contrast to the built-in `Object.getOwnPropertySymbols()`, this function returns an empty array if provided `undefined` or `null`, rather than throwing an error.\n*\n* @private\n* @param {*} value - input object\n* @returns {EmptyArray} a list of own symbol properties\n*\n* @example\n* var symbols = getOwnPropertySymbols( {} );\n* // returns []\n*/\nfunction getOwnPropertySymbols() {\n\treturn [];\n}\n\n\n// EXPORTS //\n\nexport default getOwnPropertySymbols;\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* Copy enumerable own properties from one or more source objects to a target object.\n*\n* @module @stdlib/object-assign\n*\n* @example\n* import assign from '@stdlib/object-assign';\n*\n* var out = assign( {}, { 'foo': 'bar' }, { 'baz': 'beep' } );\n* // returns { 'foo': 'bar', 'baz': 'beep' }\n*/\n\n// MODULES //\n\nimport hasObjectAssign from './has_object_assign.js';\nimport main from './builtin.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar assign;\nif ( hasObjectAssign ) {\n\tassign = main;\n} else {\n\tassign = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default assign;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport keys from '@stdlib/utils-keys';\nimport propertySymbols from '@stdlib/utils-property-symbols';\nimport isEnumerable from '@stdlib/assert-is-enumerable-property';\n\n\n// MAIN //\n\n/**\n* Returns an array of an object's own enumerable property names and symbols.\n*\n* @param {*} value - input object\n* @returns {Array} a list of own property enumerable names and symbols\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var props = enumerableProperties( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nfunction enumerableProperties( value ) {\n\tvar out;\n\tvar tmp;\n\tvar i;\n\n\tout = keys( value );\n\ttmp = propertySymbols( value );\n\tfor ( i = 0; i < tmp.length; i++ ) {\n\t\tif ( isEnumerable( value, tmp[ i ] ) ) {\n\t\t\tout.push( tmp[ i ] );\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default enumerableProperties;\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 enumerableProperties from '@stdlib/utils-enumerable-properties';\nimport Object from '@stdlib/object-ctor';\nimport format from '@stdlib/string-format';\n\n\n// MAIN //\n\n/**\n* Copies own enumerable properties from source objects to a target object.\n*\n* ## Notes\n*\n* - If a property key is present in multiple sources, the property from the last source that defines the key prevails.\n* - The target object is mutated.\n*\n* @param {Object} target - target object\n* @param {...Object} source - source object(s)\n* @throws {TypeError} first argument must not be null or undefined\n* @returns {Object} target object\n*\n* @example\n* var obj1 = {\n* 'a': 'beep'\n* };\n* var obj2 = {\n* 'b': 'boop'\n* };\n*\n* var out = assign( obj1, obj2 );\n* // returns { 'a': 'beep', 'b': 'boop' }\n*/\nfunction assign( target ) {\n\tvar source;\n\tvar keys;\n\tvar key;\n\tvar len;\n\tvar to;\n\tvar i;\n\tvar j;\n\tif ( target === void 0 || target === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a non-null object. Value: `%s`.', target ) );\n\t}\n\tto = Object( target );\n\tfor ( i = 1; i < arguments.length; i++ ) {\n\t\tsource = arguments[ i ];\n\t\tif ( source === void 0 || source === null ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tkeys = enumerableProperties( Object( source ) );\n\t\tlen = keys.length;\n\t\tfor ( j = 0; j < len; j++ ) {\n\t\t\tkey = keys[ j ];\n\t\t\tto[ key ] = source[ key ];\n\t\t}\n\t}\n\treturn to;\n}\n\n\n// EXPORTS //\n\nexport default assign;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport format from '@stdlib/string-format';\n\n\n// MAIN //\n\n/**\n* Tests that a value is a valid constructor.\n*\n* @private\n* @param {*} value - value to test\n* @returns {(Error|null)} error object or null\n*\n* @example\n* var ctor = function ctor() {};\n*\n* var err = validate( ctor );\n* // returns null\n*\n* err = validate( null );\n* // returns \n*/\nfunction validate( value ) {\n\tvar type = typeof value;\n\tif (\n\t\tvalue === null ||\n\t\t(type !== 'object' && type !== 'function')\n\t) {\n\t\treturn new TypeError( format( 'invalid argument. A provided constructor must be either an object (except null) or a function. Value: `%s`.', value ) );\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// EXPORTS //\n\nexport default Object.create;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Dummy constructor.\n*\n* @private\n*/\nfunction Ctor() {\n\t// Empty...\n}\n\n\n// MAIN //\n\n/**\n* An `Object.create` shim for older JavaScript engines.\n*\n* @private\n* @param {Object} proto - prototype\n* @returns {Object} created object\n*\n* @example\n* var obj = createObject( Object.prototype );\n* // returns {}\n*/\nfunction createObject( proto ) {\n\tCtor.prototype = proto;\n\treturn new Ctor();\n}\n\n\n// EXPORTS //\n\nexport default createObject;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 './native.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar createObject;\nif ( typeof builtin === 'function' ) {\n\tcreateObject = builtin;\n} else {\n\tcreateObject = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default createObject;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport defineProperty from '@stdlib/utils-define-property';\nimport format from '@stdlib/string-format';\nimport validate from './validate.js';\nimport createObject from './detect.js';\n\n\n// MAIN //\n\n/**\n* Implements prototypical inheritance by replacing the prototype of one constructor with the prototype of another constructor.\n*\n* ## Notes\n*\n* - This implementation is not designed to work with ES2015/ES6 classes. For ES2015/ES6 classes, use `class` with `extends`.\n* - For reference, see [node#3455](https://github.com/nodejs/node/pull/3455), [node#4179](https://github.com/nodejs/node/issues/4179), [node#3452](https://github.com/nodejs/node/issues/3452), and [node commit](https://github.com/nodejs/node/commit/29da8cf8d7ab8f66b9091ab22664067d4468461e#diff-3deb3f32958bb937ae05c6f3e4abbdf5).\n*\n* @param {(Object|Function)} ctor - constructor which will inherit\n* @param {(Object|Function)} superCtor - super (parent) constructor\n* @throws {TypeError} first argument must be either an object or a function which can inherit\n* @throws {TypeError} second argument must be either an object or a function from which a constructor can inherit\n* @throws {TypeError} second argument must have an inheritable prototype\n* @returns {(Object|Function)} child constructor\n*\n* @example\n* function Foo() {\n* return this;\n* }\n* Foo.prototype.beep = function beep() {\n* return 'boop';\n* };\n*\n* function Bar() {\n* Foo.call( this );\n* return this;\n* }\n* inherit( Bar, Foo );\n*\n* var bar = new Bar();\n* var v = bar.beep();\n* // returns 'boop'\n*/\nfunction inherit( ctor, superCtor ) {\n\tvar err = validate( ctor );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\terr = validate( superCtor );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\tif ( typeof superCtor.prototype === 'undefined' ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must have a prototype from which another object can inherit. Value: `%s`.', superCtor.prototype ) );\n\t}\n\t// Create a prototype which inherits from the parent prototype:\n\tctor.prototype = createObject( superCtor.prototype );\n\n\t// Set the constructor to refer to the child constructor:\n\tdefineProperty( ctor.prototype, 'constructor', {\n\t\t'configurable': true,\n\t\t'enumerable': false,\n\t\t'writable': true,\n\t\t'value': ctor\n\t});\n\n\treturn ctor;\n}\n\n\n// EXPORTS //\n\nexport default inherit;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport defineProperty from '@stdlib/utils-define-property';\n\n\n// MAIN //\n\n/**\n* Defines a non-enumerable 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* import objectKeys from '@stdlib/utils-keys';\n*\n* var obj = {};\n*\n* setNonEnumerableProperty( obj, 'foo', 'bar' );\n*\n* var v = obj.foo;\n* // returns 'bar'\n*\n* var keys = objectKeys( obj );\n* // returns []\n*/\nfunction setNonEnumerableProperty( obj, prop, value ) {\n\tdefineProperty( obj, prop, {\n\t\t'configurable': true,\n\t\t'enumerable': false,\n\t\t'writable': true,\n\t\t'value': value\n\t});\n}\n\n\n// EXPORTS //\n\nexport default setNonEnumerableProperty;\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\nvar proc = require( 'process' );\n\n\n// MAIN //\n\n/**\n* Adds a callback to the \"next tick queue\".\n*\n* ## Notes\n*\n* - The queue is fully drained after the current operation on the JavaScript stack runs to completion and before the event loop is allowed to continue.\n*\n* @param {Callback} clbk - callback\n* @param {...*} [args] - arguments to provide to the callback upon invocation\n*\n* @example\n* function beep() {\n* console.log( 'boop' );\n* }\n*\n* nextTick( beep );\n*/\nfunction nextTick( clbk ) {\n\tvar args;\n\tvar i;\n\n\targs = [];\n\tfor ( i = 1; i < arguments.length; i++ ) {\n\t\targs.push( arguments[ i ] );\n\t}\n\tproc.nextTick( wrapper );\n\n\t/**\n\t* Callback wrapper.\n\t*\n\t* ## Notes\n\t*\n\t* - The ability to provide additional arguments was added in Node.js v1.8.1. The wrapper provides support for earlier Node.js versions.\n\t*\n\t* @private\n\t*/\n\tfunction wrapper() {\n\t\tclbk.apply( null, args );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default nextTick;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\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 '@stdlib/assert-is-object';\nimport isFunction from '@stdlib/assert-is-function';\nimport getPrototypeOf from '@stdlib/utils-get-prototype-of';\nimport hasOwnProp from '@stdlib/assert-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) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isArray from '@stdlib/assert-is-array';\n\n\n// MAIN //\n\n/**\n* Tests if a value is an object; e.g., `{}`.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an object\n*\n* @example\n* var bool = isObject( {} );\n* // returns true\n*\n* @example\n* var bool = isObject( null );\n* // returns false\n*/\nfunction isObject( value ) {\n\treturn (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\t!isArray( value )\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isObject;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isNumber } from '@stdlib/assert-is-number';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number primitive having a nonnegative value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number primitive having a nonnegative number value\n*\n* @example\n* var bool = isNonNegativeNumber( 3.0 );\n* // returns true\n*\n* @example\n* var bool = isNonNegativeNumber( new Number( 3.0 ) );\n* // returns false\n*/\nfunction isNonNegativeNumber( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tvalue >= 0.0\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isNonNegativeNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isObject as isNumber } from '@stdlib/assert-is-number';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object having a nonnegative value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object having a nonnegative number value\n*\n* @example\n* var bool = isNonNegativeNumber( 3.0 );\n* // returns false\n*\n* @example\n* var bool = isNonNegativeNumber( new Number( 3.0 ) );\n* // returns true\n*/\nfunction isNonNegativeNumber( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tvalue.valueOf() >= 0.0\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isNonNegativeNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 number.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a nonnegative number\n*\n* @example\n* var bool = isNonNegativeNumber( 5.0 );\n* // returns true\n*\n* @example\n* var bool = isNonNegativeNumber( new Number( 5.0 ) );\n* // returns true\n*\n* @example\n* var bool = isNonNegativeNumber( 3.14 );\n* // returns true\n*\n* @example\n* var bool = isNonNegativeNumber( -5.0 );\n* // returns false\n*\n* @example\n* var bool = isNonNegativeNumber( null );\n* // returns false\n*/\nfunction isNonNegativeNumber( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nexport default isNonNegativeNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\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 number.\n*\n* @module @stdlib/assert-is-nonnegative-number\n*\n* @example\n* import isNonNegativeNumber from '@stdlib/assert-is-nonnegative-number';\n*\n* var bool = isNonNegativeNumber( 5.0 );\n* // returns true\n*\n* bool = isNonNegativeNumber( new Number( 5.0 ) );\n* // returns true\n*\n* bool = isNonNegativeNumber( 3.14 );\n* // returns true\n*\n* bool = isNonNegativeNumber( -5.0 );\n* // returns false\n*\n* bool = isNonNegativeNumber( null );\n* // returns false\n*\n* @example\n* import { isPrimitive as isNonNegativeNumber } from '@stdlib/assert-is-nonnegative-number';\n*\n* var bool = isNonNegativeNumber( 3.0 );\n* // returns true\n*\n* bool = isNonNegativeNumber( new Number( 3.0 ) );\n* // returns false\n*\n* @example\n* import { isObject as isNonNegativeNumber } from '@stdlib/assert-is-nonnegative-number';\n*\n* var bool = isNonNegativeNumber( 3.0 );\n* // returns false\n*\n* bool = isNonNegativeNumber( 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// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// MAIN //\n\nvar debug = logger( 'inspect-stream' );\n\n\n// EXPORTS //\n\nexport default debug;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar Transform = require( 'readable-stream' ).Transform;\nimport isFunction from '@stdlib/assert-is-function';\nimport assign from '@stdlib/object-assign';\nimport format from '@stdlib/string-format';\nimport inherit from '@stdlib/utils-inherit';\nimport setNonEnumerable from '@stdlib/utils-define-nonenumerable-property';\nimport setNonEnumerableReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport nextTick from '@stdlib/utils-next-tick';\nimport DEFAULTS from './defaults.json';\nimport validate from './validate.js';\nimport debug from './debug.js';\n\n\n// FUNCTIONS //\n\n/**\n* Implements the `_transform` method.\n*\n* @private\n* @param {(Uint8Array|Buffer|string)} chunk - streamed chunk\n* @param {string} encoding - Buffer encoding\n* @param {Callback} clbk - callback to invoke after transforming the streamed chunk\n*/\nfunction transform( chunk, encoding, clbk ) {\n\t/* eslint-disable no-invalid-this */\n\tthis._idx += 1;\n\tdebug( 'Received a new chunk. Chunk: %s. Encoding: %s. Index: %d.', chunk.toString(), encoding, this._idx );\n\tthis._inspect.call( null, chunk, this._idx );\n\tthis.push( chunk );\n\tclbk();\n\n\t/* eslint-enable no-invalid-this */\n}\n\n/**\n* Implements the `_flush` method.\n*\n* @private\n* @param {Callback} clbk - callback to invoke after performing flush tasks\n*/\nfunction flush( clbk ) {\n\tdebug( 'Flushing the stream...' );\n\tclbk();\n}\n\n/**\n* Gracefully destroys a stream, providing backward compatibility.\n*\n* @private\n* @param {Object} [error] - optional error message\n* @returns {InspectStream} stream instance\n*/\nfunction destroy( error ) {\n\t/* eslint-disable no-invalid-this */\n\tvar self;\n\tif ( this._destroyed ) {\n\t\tdebug( 'Attempted to destroy an already destroyed stream.' );\n\t\treturn this;\n\t}\n\tself = this;\n\tthis._destroyed = true;\n\n\tnextTick( close );\n\n\treturn this;\n\n\t/**\n\t* Closes a stream.\n\t*\n\t* @private\n\t*/\n\tfunction close() {\n\t\tif ( error ) {\n\t\t\tdebug( 'Stream was destroyed due to an error. Error: %s.', JSON.stringify( error ) );\n\t\t\tself.emit( 'error', error );\n\t\t}\n\t\tdebug( 'Closing the stream...' );\n\t\tself.emit( 'close' );\n\t}\n\n\t/* eslint-enable no-invalid-this */\n}\n\n\n// MAIN //\n\n/**\n* Inspect stream constructor.\n*\n* @constructor\n* @param {Options} [options] - stream options\n* @param {boolean} [options.objectMode=false] - specifies whether the stream should operate in object mode\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.allowHalfOpen=false] - specifies whether the stream should remain open even if one side ends\n* @param {boolean} [options.readableObjectMode=false] - specifies whether the readable side should be in object mode\n* @param {Callback} clbk - callback to invoke upon receiving data\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} must provide a callback function\n* @returns {InspectStream} inspect stream\n*\n* @example\n* function log( chunk, idx ) {\n* console.log( 'index: %d', idx );\n* console.log( chunk );\n* }\n*\n* var stream = new InspectStream( log );\n*\n* stream.write( 'a' );\n* stream.write( 'b' );\n* stream.write( 'c' );\n*\n* stream.end();\n*\n* // prints: index: 0\n* // prints: a\n* // prints: index: 1\n* // prints: b\n* // prints: index: 2\n* // prints: c\n*/\nfunction InspectStream( options, clbk ) {\n\tvar inspect;\n\tvar opts;\n\tvar err;\n\tif ( !(this instanceof InspectStream) ) {\n\t\tif ( arguments.length > 1 ) {\n\t\t\treturn new InspectStream( options, clbk );\n\t\t}\n\t\treturn new InspectStream( options );\n\t}\n\topts = assign( {}, DEFAULTS );\n\tif ( arguments.length > 1 ) {\n\t\tinspect = clbk;\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t} else {\n\t\tinspect = options;\n\t}\n\tif ( !isFunction( inspect ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Callback argument must be a function. Value: `%s`.', inspect ) );\n\t}\n\t// The stream's writable state should always be in object mode to prevent incoming data from being buffered (concatenated) and thus lose separation...\n\topts.writableObjectMode = true;\n\n\t// Make the stream a Transform stream:\n\tdebug( 'Creating a transform stream configured with the following options: %s.', JSON.stringify( opts ) );\n\tTransform.call( this, opts );\n\n\t// The destruction state:\n\tsetNonEnumerable( this, '_destroyed', false );\n\n\t// Initialize a chunk counter:\n\tsetNonEnumerable( this, '_idx', -1 );\n\n\t// Cache a reference to the inspect callback:\n\tsetNonEnumerableReadOnly( this, '_inspect', inspect );\n\n\treturn this;\n}\n\n/*\n* Inherit from the `Transform` prototype.\n*/\ninherit( InspectStream, Transform );\n\n/**\n* Implements the `_transform` method.\n*\n* @private\n* @name _transform\n* @memberof InspectStream.prototype\n* @type {Function}\n* @param {(Buffer|string)} chunk - streamed chunk\n* @param {string} encoding - Buffer encoding\n* @param {Callback} clbk - callback to invoke after transforming the streamed chunk\n*/\nsetNonEnumerableReadOnly( InspectStream.prototype, '_transform', transform );\n\n/**\n* Implements the `_flush` method.\n*\n* @private\n* @name _flush\n* @memberof InspectStream.prototype\n* @type {Function}\n* @param {Callback} clbk - callback to invoke after performing flush tasks\n*/\nsetNonEnumerableReadOnly( InspectStream.prototype, '_flush', flush );\n\n/**\n* Gracefully destroys a stream, providing backward compatibility.\n*\n* @name destroy\n* @memberof InspectStream.prototype\n* @type {Function}\n* @param {Object} [error] - optional error message\n* @returns {InspectStream} stream instance\n*/\nsetNonEnumerableReadOnly( InspectStream.prototype, 'destroy', destroy );\n\n\n// EXPORTS //\n\nexport default InspectStream;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isNonNegative } from '@stdlib/assert-is-nonnegative-number';\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 {boolean} [options.objectMode] - specifies whether a stream should operate in object mode\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.allowHalfOpen] - specifies whether the stream should remain open even if one side ends\n* @param {boolean} [options.readableObjectMode] - specifies whether the readable side should be in object mode\n* @returns {(Error|null)} null or an error object\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, 'objectMode' ) ) {\n\t\topts.objectMode = options.objectMode;\n\t\tif ( !isBoolean( opts.objectMode ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'objectMode', opts.objectMode ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'readableObjectMode' ) ) {\n\t\topts.readableObjectMode = options.readableObjectMode;\n\t\tif ( !isBoolean( opts.readableObjectMode ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'readableObjectMode', opts.readableObjectMode ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'allowHalfOpen' ) ) {\n\t\topts.allowHalfOpen = options.allowHalfOpen;\n\t\tif ( !isBoolean( opts.allowHalfOpen ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'allowHalfOpen', opts.allowHalfOpen ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'highWaterMark' ) ) {\n\t\topts.highWaterMark = options.highWaterMark;\n\t\tif ( !isNonNegative( opts.highWaterMark ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a nonnegative number. Option: `%s`.', 'highWaterMark', opts.highWaterMark ) );\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/**\n* Transform stream which inspects streamed data.\n*\n* @module @stdlib/streams-node-inspect\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect';\n*\n* function log( chunk, idx ) {\n* console.log( 'index: %d', idx );\n* console.log( chunk );\n* // => index: 0\\na\\nindex: 1\\nb\\nindex: 2\\nc\\n\n* }\n*\n* var stream = inspectStream( log );\n*\n* stream.write( 'a' );\n* stream.write( 'b' );\n* stream.write( 'c' );\n*\n* stream.end();\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect';\n*\n* function log( chunk, idx ) {\n* console.log( 'index: %d', idx );\n* console.log( chunk );\n* // => index: 0\\n{'value': 'a'}\\nindex: 1\\n{'value': 'b'}\\nindex: 2\\n{'value': 'c'}\\n\n* }\n*\n* var stream = inspectStream.objectMode( log );\n*\n* stream.write( {'value': 'a'} );\n* stream.write( {'value': 'b'} );\n* stream.write( {'value': 'c'} );\n*\n* stream.end();\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect';\n*\n* function log( chunk, idx ) {\n* console.log( 'index: %d', idx );\n* console.log( chunk );\n* }\n*\n* var opts = {\n* 'objectMode': true,\n* 'highWaterMark': 64\n* };\n*\n* var factory = inspectStream.factory( opts );\n*\n* // Create 10 identically configured streams...\n* var streams = [];\n* var i;\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( factory( log ) );\n* }\n*/\n\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport objectMode from './object_mode.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'objectMode', objectMode );\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 isObject from '@stdlib/assert-is-plain-object';\nimport format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport Stream from './main.js';\n\n\n// MAIN //\n\n/**\n* Returns an inspect stream with `objectMode` set to `true`.\n*\n* @param {Options} [options] - stream options\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.allowHalfOpen=false] - specifies whether the stream should remain open even if one side ends\n* @param {boolean} [options.readableObjectMode=false] - specifies whether the readable side should be in object mode\n* @param {Callback} clbk - callback to invoke upon receiving data\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} must provide a callback function\n* @returns {InspectStream} inspect stream\n*\n* @example\n* function log( chunk, idx ) {\n* console.log( 'index: %d', idx );\n* console.log( chunk );\n* }\n*\n* var stream = objectMode( log );\n*\n* stream.write( {'value': 'a'} );\n* stream.write( {'value': 'b'} );\n* stream.write( {'value': 'c'} );\n*\n* stream.end();\n*\n* // prints: index: 0\n* // prints: {'value': 'a'}\n* // prints: index: 1\n* // prints: {'value': 'b'}\n* // prints: index: 2\n* // prints: {'value': 'c'}\n*/\nfunction objectMode( options, clbk ) {\n\tvar opts;\n\tvar cb;\n\tif ( arguments.length > 1 ) {\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\topts = assign( {}, options );\n\t\tcb = clbk;\n\t} else {\n\t\topts = {};\n\t\tcb = options;\n\t}\n\topts.objectMode = true;\n\treturn new Stream( opts, cb );\n}\n\n\n// EXPORTS //\n\nexport default objectMode;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport Stream from './main.js';\n\n\n// MAIN //\n\n/**\n* Creates a reusable inspect stream factory.\n*\n* @param {Options} [options] - stream options\n* @param {boolean} [options.objectMode=false] - specifies whether the stream should operate in object mode\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.allowHalfOpen=false] - specifies whether the stream should remain open even if one side ends\n* @param {boolean} [options.readableObjectMode=false] - specifies whether the readable side should be in object mode\n* @throws {TypeError} options argument must be an object\n* @returns {Function} inspect stream factory\n*\n* @example\n* function log( chunk, idx ) {\n* console.log( 'index: %d', idx );\n* console.log( chunk );\n* }\n*\n* var opts = {\n* 'objectMode': true,\n* 'highWaterMark': 64\n* };\n*\n* var factory = streamFactory( opts );\n*\n* // Create 10 identically configured streams...\n* var streams = [];\n* var i;\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( factory( log ) );\n* }\n*/\nfunction streamFactory( options ) {\n\tvar opts;\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\topts = assign( {}, options );\n\t} else {\n\t\topts = {};\n\t}\n\treturn inspectStream;\n\n\t/**\n\t* Creates a transform stream for inspecting streamed data.\n\t*\n\t* @private\n\t* @param {Callback} clbk - callback to invoke upon receiving data\n\t* @throws {TypeError} must provide valid options\n\t* @throws {TypeError} must provide a callback function\n\t* @returns {InspectStream} inspect stream\n\t*/\n\tfunction inspectStream( clbk ) {\n\t\treturn new Stream( opts, clbk );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default streamFactory;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 'debug-stream';\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport NAMESPACE from './namespace.js';\n\n\n// MAIN //\n\nvar debug = logger( NAMESPACE );\n\n\n// EXPORTS //\n\nexport default debug;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isNonNegative } from '@stdlib/assert-is-nonnegative-number';\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.name] - debug namespace\n* @param {boolean} [options.objectMode] - specifies whether a stream should operate in object mode\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.allowHalfOpen] - specifies whether the stream should remain open even if one side ends\n* @param {boolean} [options.readableObjectMode] - specifies whether the readable side should be in object mode\n* @returns {(Error|null)} null or an error object\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, 'name' ) ) {\n\t\topts.name = options.name;\n\t\tif ( !isString( opts.name ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'name', opts.name ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'objectMode' ) ) {\n\t\topts.objectMode = options.objectMode;\n\t\tif ( !isBoolean( opts.objectMode ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'objectMode', opts.objectMode ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'readableObjectMode' ) ) {\n\t\topts.readableObjectMode = options.readableObjectMode;\n\t\tif ( !isBoolean( opts.readableObjectMode ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'readableObjectMode', opts.readableObjectMode ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'allowHalfOpen' ) ) {\n\t\topts.allowHalfOpen = options.allowHalfOpen;\n\t\tif ( !isBoolean( opts.allowHalfOpen ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'allowHalfOpen', opts.allowHalfOpen ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'highWaterMark' ) ) {\n\t\topts.highWaterMark = options.highWaterMark;\n\t\tif ( !isNonNegative( opts.highWaterMark ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a nonnegative number. Option: `%s`.', 'highWaterMark', opts.highWaterMark ) );\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\nvar debug = require( 'debug' );\n\n\n// EXPORTS //\n\nexport default debug;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport InspectStream from '@stdlib/streams-node-inspect';\nimport isFunction from '@stdlib/assert-is-function';\nimport isBuffer from '@stdlib/assert-is-buffer';\nimport format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport inherit from '@stdlib/utils-inherit';\nimport debug from './debug.js';\nimport DEFAULTS from './defaults.json';\nimport NAMESPACE from './namespace.js';\nimport validate from './validate.js';\nimport logger from './logger.js';\n\n\n// MAIN //\n\n/**\n* Debug stream constructor.\n*\n* @constructor\n* @param {Options} [options] - stream options\n* @param {string} [options.name] - debug namespace\n* @param {boolean} [options.objectMode=false] - specifies whether the stream should operate in object mode\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.allowHalfOpen=false] - specifies whether the stream should remain open even if one side ends\n* @param {boolean} [options.readableObjectMode=false] - specifies whether the readable side should be in object mode\n* @param {Callback} [clbk] - callback to invoke upon receiving data\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} must a valid callback argument\n* @returns {DebugStream} debug stream\n*\n* @example\n* var stream = new DebugStream({\n* 'name': 'my-stream'\n* });\n*\n* stream.write( 'a' );\n* stream.write( 'b' );\n* stream.write( 'c' );\n* stream.end();\n*/\nfunction DebugStream( options, clbk ) {\n\tvar opts;\n\tvar name;\n\tvar log;\n\tvar err;\n\tvar cb;\n\tif ( !(this instanceof DebugStream) ) {\n\t\tif ( arguments.length > 1 ) {\n\t\t\treturn new DebugStream( options, clbk );\n\t\t}\n\t\tif ( arguments.length === 1 ) {\n\t\t\treturn new DebugStream( options );\n\t\t}\n\t\treturn new DebugStream();\n\t}\n\topts = assign( {}, DEFAULTS );\n\tif ( arguments.length > 1 ) {\n\t\tif ( !isFunction( clbk ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Callback argument must be a function. Value: `%s`.', clbk ) );\n\t\t}\n\t\tcb = clbk;\n\t\terr = validate( opts, options );\n\t} else if ( arguments.length ) {\n\t\tif ( isFunction( options ) ) {\n\t\t\tcb = options;\n\t\t} else {\n\t\t\terr = validate( opts, options );\n\t\t}\n\t}\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\tif ( opts.name ) {\n\t\tname = NAMESPACE + ':' + opts.name;\n\t} else {\n\t\tname = NAMESPACE;\n\t}\n\tlog = logger( name );\n\n\tdebug( 'Creating a transform stream configured with the following options: %s.', JSON.stringify( opts ) );\n\tInspectStream.call( this, opts, inspect );\n\n\treturn this;\n\n\t/**\n\t* Callback invoked upon receiving a new chunk.\n\t*\n\t* @private\n\t* @param {*} chunk - received chunk\n\t* @param {NonNegativeInteger} idx - chunk index\n\t* @returns {void}\n\t*/\n\tfunction inspect( chunk, idx ) {\n\t\tif ( cb ) {\n\t\t\tdebug( 'Received a new chunk. Chunk: %s. Index: %d.', chunk.toString(), idx );\n\t\t\treturn cb( log, chunk, idx );\n\t\t}\n\t\tif ( isBuffer( chunk ) ) {\n\t\t\tchunk = chunk.toString();\n\t\t}\n\t\tchunk = JSON.stringify( chunk );\n\t\tdebug( 'Received a new chunk. Chunk: %s. Index: %d.', chunk, idx );\n\t\tlog( 'Chunk: %s. Index: %d.', chunk, idx );\n\t}\n}\n\n/*\n* Inherit from the `InspectStream` prototype.\n*/\ninherit( DebugStream, InspectStream );\n\n\n// EXPORTS //\n\nexport default DebugStream;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Transform stream for debugging stream pipelines.\n*\n* @module @stdlib/streams-node-debug\n*\n* @example\n* import debugStream from '@stdlib/streams-node-debug';\n*\n* var stream = debugStream({\n* 'name': 'my-stream'\n* });\n*\n* stream.write( 'a' );\n* stream.write( 'b' );\n* stream.write( 'c' );\n* stream.end();\n*\n* @example\n* import debugStream from '@stdlib/streams-node-debug';\n*\n* var stream = debugStream.objectMode({\n* 'name': 'my-stream'\n* });\n*\n* stream.write( {'value': 'a'} );\n* stream.write( {'value': 'b'} );\n* stream.write( {'value': 'c'} );\n* stream.end();\n*\n* @example\n* import debugStream from '@stdlib/streams-node-debug';\n*\n* var opts = {\n* 'objectMode': true,\n* 'highWaterMark': 64\n* };\n*\n* var factory = debugStream.factory( opts );\n*\n* // Assign each stream to a separate 'debug' namespace...\n* var streams = [];\n* var i;\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( factory( 'stream '+i ) );\n* }\n*/\n\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport objectMode from './object_mode.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'objectMode', objectMode );\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 isFunction from '@stdlib/assert-is-function';\nimport isObject from '@stdlib/assert-is-plain-object';\nimport format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport Stream from './main.js';\n\n\n// MAIN //\n\n/**\n* Returns a debug stream with `objectMode` set to `true`.\n*\n* @param {Options} [options] - stream options\n* @param {string} [options.name] - debug namespace\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.allowHalfOpen=false] - specifies whether the stream should remain open even if one side ends\n* @param {boolean} [options.readableObjectMode=false] - specifies whether the readable side should be in object mode\n* @param {Callback} [clbk] - callback to invoke upon receiving data\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} must provide a valid callback argument\n* @returns {DebugStream} debug stream\n*\n* @example\n* var stream = objectMode({\n* 'name': 'my-stream'\n* });\n*\n* stream.write( {'value': 'a'} );\n* stream.write( {'value': 'b'} );\n* stream.write( {'value': 'c'} );\n* stream.end();\n*/\nfunction objectMode( options, clbk ) {\n\tvar opts;\n\tvar cb;\n\tif ( arguments.length > 1 ) {\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\topts = assign( {}, options );\n\t\tcb = clbk;\n\t\tif ( !isFunction( clbk ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Callback argument must be a function. Value: `%s`.', clbk ) );\n\t\t}\n\t} else if ( arguments.length ) {\n\t\tif ( isFunction( options ) ) {\n\t\t\topts = {};\n\t\t\tcb = options;\n\t\t} else {\n\t\t\tif ( !isObject( options ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t\t\t}\n\t\t\topts = assign( {}, options );\n\t\t}\n\t} else {\n\t\topts = {};\n\t}\n\topts.objectMode = true;\n\tif ( cb === void 0 ) {\n\t\treturn new Stream( opts );\n\t}\n\treturn new Stream( opts, cb );\n}\n\n\n// EXPORTS //\n\nexport default objectMode;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport Stream from './main.js';\n\n\n// MAIN //\n\n/**\n* Creates a reusable debug stream factory.\n*\n* @param {Options} [options] - stream options\n* @param {boolean} [options.objectMode=false] - specifies whether the stream should operate in object mode\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.allowHalfOpen=false] - specifies whether the stream should remain open even if one side ends\n* @param {boolean} [options.readableObjectMode=false] - specifies whether the readable side should be in object mode\n* @throws {TypeError} options argument must be an object\n* @returns {Function} debug stream factory\n*\n* @example\n* var opts = {\n* 'objectMode': true,\n* 'highWaterMark': 64\n* };\n*\n* var factory = streamFactory( opts );\n*\n* // Assign each stream to a separate debug namespace...\n* var streams = [];\n* var i;\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( factory( 'stream '+i ) );\n* }\n*/\nfunction streamFactory( options ) {\n\tvar opts;\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\topts = assign( {}, options );\n\t} else {\n\t\topts = {};\n\t}\n\treturn debugStream;\n\n\t/**\n\t* Creates a transform stream for debugging stream pipelines.\n\t*\n\t* @private\n\t* @param {string} name - debug namespace\n\t* @param {Callback} [clbk] - callback to invoke upon receiving data\n\t* @throws {TypeError} must provide valid options\n\t* @throws {TypeError} must provide a valid callback argument\n\t* @returns {DebugStream} debug stream\n\t*/\n\tfunction debugStream( name, clbk ) {\n\t\topts.name = name;\n\t\tif ( arguments.length > 1 ) {\n\t\t\treturn new Stream( opts, clbk );\n\t\t}\n\t\treturn new Stream( opts );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default streamFactory;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// MAIN //\n\nvar debug = logger( 'inspect-stream-sink' );\n\n\n// EXPORTS //\n\nexport default debug;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar Writable = require( 'readable-stream' ).Writable;\nimport isFunction from '@stdlib/assert-is-function';\nimport assign from '@stdlib/object-assign';\nimport inherit from '@stdlib/utils-inherit';\nimport setNonEnumerable from '@stdlib/utils-define-nonenumerable-property';\nimport setNonEnumerableReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport nextTick from '@stdlib/utils-next-tick';\nimport format from '@stdlib/string-format';\nimport DEFAULTS from './defaults.json';\nimport validate from './validate.js';\nimport debug from './debug.js';\n\n\n// FUNCTIONS //\n\n/**\n* Implements the `_write` method.\n*\n* @private\n* @param {(Uint8Array|Buffer|string)} chunk - streamed chunk\n* @param {string} encoding - Buffer encoding\n* @param {Callback} clbk - callback to invoke after processing the streamed chunk\n* @returns {void}\n*/\nfunction write( chunk, encoding, clbk ) {\n\t/* eslint-disable no-invalid-this */\n\tthis._idx += 1;\n\tdebug( 'Received a new chunk. Chunk: %s. Encoding: %s. Index: %d.', chunk.toString(), encoding, this._idx );\n\tthis._inspect.call( null, chunk, this._idx );\n\n\t// Once destroyed, ensure we do not block the event-loop when an upstream stream pipeline is behaving synchronously (otherwise, by continuing to process stream data synchronously, we'll continue receiving data and the stream will never be destroyed)...\n\tif ( this._destroyed ) {\n\t\treturn nextTick( clbk );\n\t}\n\tclbk();\n\n\t/* eslint-enable no-invalid-this */\n}\n\n/**\n* Gracefully destroys a stream, providing backward compatibility.\n*\n* @private\n* @param {Object} [error] - optional error message\n* @returns {InspectSinkStream} stream instance\n*/\nfunction destroy( error ) {\n\t/* eslint-disable no-invalid-this */\n\tvar self;\n\tif ( this._destroyed ) {\n\t\tdebug( 'Attempted to destroy an already destroyed stream.' );\n\t\treturn this;\n\t}\n\tself = this;\n\tthis._destroyed = true;\n\n\tnextTick( close );\n\n\treturn this;\n\n\t/**\n\t* Closes a stream.\n\t*\n\t* @private\n\t*/\n\tfunction close() {\n\t\tif ( error ) {\n\t\t\tdebug( 'Stream was destroyed due to an error. Error: %s.', JSON.stringify( error ) );\n\t\t\tself.emit( 'error', error );\n\t\t}\n\t\tdebug( 'Closing the stream...' );\n\t\tself.emit( 'close' );\n\t}\n\n\t/* eslint-enable no-invalid-this */\n}\n\n\n// MAIN //\n\n/**\n* Inspect stream constructor.\n*\n* @constructor\n* @param {Options} [options] - stream options\n* @param {boolean} [options.objectMode=false] - specifies whether the stream should operate in object mode\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.decodeStrings=true] - specifies whether to encode strings as `Buffer` objects before writing data to a returned stream\n* @param {string} [options.defaultEncoding='utf8'] - default encoding when not explicitly specified when writing data\n* @param {Callback} clbk - callback to invoke upon receiving data\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} must provide a callback function\n* @returns {InspectSinkStream} inspect stream\n*\n* @example\n* function log( chunk, idx ) {\n* console.log( 'index: %d', idx );\n* console.log( chunk );\n* }\n*\n* var stream = new InspectSinkStream( log );\n*\n* stream.write( 'a' );\n* stream.write( 'b' );\n* stream.write( 'c' );\n*\n* stream.end();\n*\n* // prints: index: 0\n* // prints: a\n* // prints: index: 1\n* // prints: b\n* // prints: index: 2\n* // prints: c\n*/\nfunction InspectSinkStream( options, clbk ) {\n\tvar inspect;\n\tvar opts;\n\tvar err;\n\tif ( !(this instanceof InspectSinkStream) ) {\n\t\tif ( arguments.length > 1 ) {\n\t\t\treturn new InspectSinkStream( options, clbk );\n\t\t}\n\t\treturn new InspectSinkStream( options );\n\t}\n\topts = assign( {}, DEFAULTS );\n\tif ( arguments.length > 1 ) {\n\t\tinspect = clbk;\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t} else {\n\t\tinspect = options;\n\t}\n\tif ( !isFunction( inspect ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Callback argument must be a function. Value: `%s`.', inspect ) );\n\t}\n\t// Make the stream a Writable stream:\n\tdebug( 'Creating a writable stream configured with the following options: %s.', JSON.stringify( opts ) );\n\tWritable.call( this, opts );\n\n\t// The destruction state:\n\tsetNonEnumerable( this, '_destroyed', false );\n\n\t// Initialize a chunk counter:\n\tsetNonEnumerable( this, '_idx', -1 );\n\n\t// Cache a reference to the inspect callback:\n\tsetNonEnumerableReadOnly( this, '_inspect', inspect );\n\n\treturn this;\n}\n\n/*\n* Inherit from the `Writable` prototype.\n*/\ninherit( InspectSinkStream, Writable );\n\n/**\n* Implements the `_write` method.\n*\n* @private\n* @name _write\n* @memberof InspectSinkStream.prototype\n* @type {Function}\n* @param {(Buffer|string)} chunk - streamed chunk\n* @param {string} encoding - Buffer encoding\n* @param {Callback} clbk - callback to invoke after processing the streamed chunk\n*/\nsetNonEnumerableReadOnly( InspectSinkStream.prototype, '_write', write );\n\n/**\n* Gracefully destroys a stream, providing backward compatibility.\n*\n* @name destroy\n* @memberof InspectSinkStream.prototype\n* @type {Function}\n* @param {Object} [error] - optional error message\n* @returns {InspectSinkStream} stream instance\n*/\nsetNonEnumerableReadOnly( InspectSinkStream.prototype, 'destroy', destroy );\n\n\n// EXPORTS //\n\nexport default InspectSinkStream;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 { isPrimitive as isNonNegative } from '@stdlib/assert-is-nonnegative-number';\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 {boolean} [options.objectMode] - specifies whether a stream should operate in object mode\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.decodeStrings] - specifies whether to encode strings as `Buffer` objects before writing data to a returned stream\n* @param {string} [options.defaultEncoding] - default encoding when not explicitly specified when writing data\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'objectMode': true\n* };\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, 'objectMode' ) ) {\n\t\topts.objectMode = options.objectMode;\n\t\tif ( !isBoolean( opts.objectMode ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'objectMode', opts.objectMode ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'highWaterMark' ) ) {\n\t\topts.highWaterMark = options.highWaterMark;\n\t\tif ( !isNonNegative( opts.highWaterMark ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a nonnegative number. Option: `%s`.', 'highWaterMark', opts.highWaterMark ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'decodeStrings' ) ) {\n\t\topts.decodeStrings = options.decodeStrings;\n\t\tif ( !isBoolean( opts.decodeStrings ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'decodeStrings', opts.decodeStrings ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'defaultEncoding' ) ) {\n\t\topts.defaultEncoding = options.defaultEncoding;\n\t\tif ( !isString( opts.defaultEncoding ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'defaultEncoding', opts.defaultEncoding ) );\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/**\n* Writable stream which inspects streamed data.\n*\n* @module @stdlib/streams-node-inspect-sink\n*\n* @example\n* import inspectSinkStream from '@stdlib/streams-node-inspect-sink';\n*\n* function log( chunk, idx ) {\n* console.log( 'index: %d', idx );\n* console.log( chunk );\n* }\n*\n* var stream = inspectSinkStream( log );\n*\n* stream.write( 'a' );\n* stream.write( 'b' );\n* stream.write( 'c' );\n*\n* stream.end();\n*\n* // prints: index: 0\n* // prints: a\n* // prints: index: 1\n* // prints: b\n* // prints: index: 2\n* // prints: c\n*\n* @example\n* import inspectSinkStream from '@stdlib/streams-node-inspect-sink';\n*\n* function log( chunk, idx ) {\n* console.log( 'index: %d', idx );\n* console.log( chunk );\n* }\n*\n* var stream = inspectSinkStream.objectMode( log );\n*\n* stream.write( {'value': 'a'} );\n* stream.write( {'value': 'b'} );\n* stream.write( {'value': 'c'} );\n*\n* stream.end();\n*\n* // prints: index: 0\n* // prints: {'value': 'a'}\n* // prints: index: 1\n* // prints: {'value': 'b'}\n* // prints: index: 2\n* // prints: {'value': 'c'}\n*\n* @example\n* import inspectSinkStream from '@stdlib/streams-node-inspect-sink';\n*\n* function log( chunk, idx ) {\n* console.log( 'index: %d', idx );\n* console.log( chunk );\n* }\n*\n* var opts = {\n* 'objectMode': true,\n* 'highWaterMark': 64\n* };\n*\n* var factory = inspectSinkStream.factory( opts );\n*\n* // Create 10 identically configured streams...\n* var streams = [];\n* var i;\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( factory( log ) );\n* }\n*/\n\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport objectMode from './object_mode.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'objectMode', objectMode );\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 isObject from '@stdlib/assert-is-plain-object';\nimport format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport Stream from './main.js';\n\n\n// MAIN //\n\n/**\n* Returns an inspect stream with `objectMode` set to `true`.\n*\n* @param {Options} [options] - stream options\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.decodeStrings=true] - specifies whether to encode strings as `Buffer` objects before writing data to a returned stream\n* @param {string} [options.defaultEncoding='utf8'] - default encoding when not explicitly specified when writing data\n* @param {Callback} clbk - callback to invoke upon receiving data\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} must provide a callback function\n* @returns {InspectSinkStream} inspect stream\n*\n* @example\n* function log( chunk, idx ) {\n* console.log( 'index: %d', idx );\n* console.log( chunk );\n* }\n*\n* var stream = objectMode( log );\n*\n* stream.write( {'value': 'a'} );\n* stream.write( {'value': 'b'} );\n* stream.write( {'value': 'c'} );\n*\n* stream.end();\n*\n* // prints: 'index: 0'\n* // prints: {'value': 'a'}\n* // prints: 'index: 1'\n* // prints: {'value': 'b'}\n* // prints: 'index: 2'\n* // prints: {'value': 'c'}\n*/\nfunction objectMode( options, clbk ) {\n\tvar opts;\n\tvar cb;\n\tif ( arguments.length > 1 ) {\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\topts = assign( {}, options );\n\t\tcb = clbk;\n\t} else {\n\t\topts = {};\n\t\tcb = options;\n\t}\n\topts.objectMode = true;\n\treturn new Stream( opts, cb );\n}\n\n\n// EXPORTS //\n\nexport default objectMode;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport Stream from './main.js';\n\n\n// MAIN //\n\n/**\n* Creates a reusable inspect stream factory.\n*\n* @param {Options} [options] - stream options\n* @param {boolean} [options.objectMode=false] - specifies whether the stream should operate in object mode\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.decodeStrings=true] - specifies whether to encode strings as `Buffer` objects before writing data to a returned stream\n* @param {string} [options.defaultEncoding='utf8'] - default encoding when not explicitly specified when writing data\n* @throws {TypeError} options argument must be an object\n* @returns {Function} inspect stream factory\n*\n* @example\n* function log( chunk, idx ) {\n* console.log( 'index: %d', idx );\n* console.log( chunk );\n* }\n*\n* var opts = {\n* 'objectMode': true,\n* 'highWaterMark': 64\n* };\n*\n* var factory = streamFactory( opts );\n*\n* // Create 10 identically configured streams...\n* var streams = [];\n* var i;\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( factory( log ) );\n* }\n*/\nfunction streamFactory( options ) {\n\tvar opts;\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\topts = assign( {}, options );\n\t} else {\n\t\topts = {};\n\t}\n\treturn inspectStream;\n\n\t/**\n\t* Creates a writable stream for inspecting streamed data.\n\t*\n\t* @private\n\t* @param {Callback} clbk - callback to invoke upon receiving data\n\t* @throws {TypeError} must provide valid options\n\t* @throws {TypeError} must provide a callback function\n\t* @returns {InspectStream} inspect stream\n\t*/\n\tfunction inspectStream( clbk ) {\n\t\treturn new Stream( opts, clbk );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default streamFactory;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 'debug-stream-sink';\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport NAMESPACE from './namespace.js';\n\n\n// MAIN //\n\nvar debug = logger( NAMESPACE );\n\n\n// EXPORTS //\n\nexport default debug;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isNonNegative } from '@stdlib/assert-is-nonnegative-number';\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.name] - debug namespace\n* @param {boolean} [options.objectMode] - specifies whether a stream should operate in object mode\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.decodeStrings] - specifies whether to encode strings as `Buffer` objects before writing data to a returned stream\n* @param {string} [options.defaultEncoding] - default encoding when not explicitly specified when writing data\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'objectMode': true\n* };\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, 'name' ) ) {\n\t\topts.name = options.name;\n\t\tif ( !isString( opts.name ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'name', opts.name ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'objectMode' ) ) {\n\t\topts.objectMode = options.objectMode;\n\t\tif ( !isBoolean( opts.objectMode ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'objectMode', opts.objectMode ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'highWaterMark' ) ) {\n\t\topts.highWaterMark = options.highWaterMark;\n\t\tif ( !isNonNegative( opts.highWaterMark ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a nonnegative number. Option: `%s`.', 'highWaterMark', opts.highWaterMark ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'decodeStrings' ) ) {\n\t\topts.decodeStrings = options.decodeStrings;\n\t\tif ( !isBoolean( opts.decodeStrings ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'decodeStrings', opts.decodeStrings ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'defaultEncoding' ) ) {\n\t\topts.defaultEncoding = options.defaultEncoding;\n\t\tif ( !isString( opts.defaultEncoding ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'defaultEncoding', opts.defaultEncoding ) );\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\nvar debug = require( 'debug' );\n\n\n// EXPORTS //\n\nexport default debug;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport InspectSinkStream from '@stdlib/streams-node-inspect-sink';\nimport isFunction from '@stdlib/assert-is-function';\nimport isBuffer from '@stdlib/assert-is-buffer';\nimport format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport inherit from '@stdlib/utils-inherit';\nimport debug from './debug.js';\nimport DEFAULTS from './defaults.json';\nimport NAMESPACE from './namespace.js';\nimport validate from './validate.js';\nimport logger from './logger.js';\n\n\n// MAIN //\n\n/**\n* Debug stream constructor.\n*\n* @constructor\n* @param {Options} [options] - stream options\n* @param {string} [options.name] - debug namespace\n* @param {boolean} [options.objectMode=false] - specifies whether the stream should operate in object mode\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.decodeStrings=true] - specifies whether to encode strings as `Buffer` objects before writing data to a returned stream\n* @param {string} [options.defaultEncoding='utf8'] - default encoding when not explicitly specified when writing data\n* @param {Callback} [clbk] - callback to invoke upon receiving data\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} must a valid callback argument\n* @returns {DebugSinkStream} debug stream\n*\n* @example\n* var stream = new DebugSinkStream({\n* 'name': 'my-stream'\n* });\n*\n* stream.write( 'a' );\n* stream.write( 'b' );\n* stream.write( 'c' );\n* stream.end();\n*/\nfunction DebugSinkStream( options, clbk ) {\n\tvar opts;\n\tvar name;\n\tvar log;\n\tvar err;\n\tvar cb;\n\tif ( !(this instanceof DebugSinkStream) ) {\n\t\tif ( arguments.length > 1 ) {\n\t\t\treturn new DebugSinkStream( options, clbk );\n\t\t}\n\t\tif ( arguments.length === 1 ) {\n\t\t\treturn new DebugSinkStream( options );\n\t\t}\n\t\treturn new DebugSinkStream();\n\t}\n\topts = assign( {}, DEFAULTS );\n\tif ( arguments.length > 1 ) {\n\t\tif ( !isFunction( clbk ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Callback argument must be a function. Value: `%s`.', clbk ) );\n\t\t}\n\t\tcb = clbk;\n\t\terr = validate( opts, options );\n\t} else if ( arguments.length ) {\n\t\tif ( isFunction( options ) ) {\n\t\t\tcb = options;\n\t\t} else {\n\t\t\terr = validate( opts, options );\n\t\t}\n\t}\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\tif ( opts.name ) {\n\t\tname = NAMESPACE + ':' + opts.name;\n\t} else {\n\t\tname = NAMESPACE;\n\t}\n\tlog = logger( name );\n\n\tdebug( 'Creating a writable stream configured with the following options: %s.', JSON.stringify( opts ) );\n\tInspectSinkStream.call( this, opts, inspect );\n\n\treturn this;\n\n\t/**\n\t* Callback invoked upon receiving a new chunk.\n\t*\n\t* @private\n\t* @param {*} chunk - received chunk\n\t* @param {NonNegativeInteger} idx - chunk index\n\t* @returns {void}\n\t*/\n\tfunction inspect( chunk, idx ) {\n\t\tif ( cb ) {\n\t\t\tdebug( 'Received a new chunk. Chunk: %s. Index: %d.', chunk.toString(), idx );\n\t\t\treturn cb( log, chunk, idx );\n\t\t}\n\t\tif ( isBuffer( chunk ) ) {\n\t\t\tchunk = chunk.toString();\n\t\t}\n\t\tchunk = JSON.stringify( chunk );\n\t\tdebug( 'Received a new chunk. Chunk: %s. Index: %d.', chunk, idx );\n\t\tlog( 'Chunk: %s. Index: %d.', chunk, idx );\n\t}\n}\n\n/*\n* Inherit from the `InspectSinkStream` prototype.\n*/\ninherit( DebugSinkStream, InspectSinkStream );\n\n\n// EXPORTS //\n\nexport default DebugSinkStream;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport getPrototypeOf from '@stdlib/utils-get-prototype-of';\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// MAIN //\n\n/**\n* Tests if a value is an `Error` object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is an `Error` object\n*\n* @example\n* var bool = isError( new Error( 'beep' ) );\n* // returns true\n*\n* @example\n* var bool = isError( {} );\n* // returns false\n*/\nfunction isError( value ) {\n\tif ( typeof value !== 'object' || value === null ) {\n\t\treturn false;\n\t}\n\t// Check for `Error` objects from the same realm (same Node.js `vm` or same `Window` object)...\n\tif ( value instanceof Error ) {\n\t\treturn true;\n\t}\n\t// Walk the prototype tree until we find an object having the desired native class...\n\twhile ( value ) {\n\t\tif ( nativeClass( value ) === '[object Error]' ) {\n\t\t\treturn true;\n\t\t}\n\t\tvalue = getPrototypeOf( value );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nexport default isError;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Writable stream for debugging stream pipelines.\n*\n* @module @stdlib/streams-node-debug-sink\n*\n* @example\n* import debugSinkStream from '@stdlib/streams-node-debug-sink';\n*\n* var stream = debugSinkStream({\n* 'name': 'my-stream'\n* });\n*\n* stream.write( 'a' );\n* stream.write( 'b' );\n* stream.write( 'c' );\n* stream.end();\n*\n* @example\n* import debugSinkStream from '@stdlib/streams-node-debug-sink';\n*\n* var stream = debugSinkStream.objectMode({\n* 'name': 'my-stream'\n* });\n*\n* stream.write( {'value': 'a'} );\n* stream.write( {'value': 'b'} );\n* stream.write( {'value': 'c'} );\n* stream.end();\n*\n* @example\n* import debugSinkStream from '@stdlib/streams-node-debug-sink';\n*\n* var opts = {\n* 'objectMode': true,\n* 'highWaterMark': 64\n* };\n*\n* var factory = debugSinkStream.factory( opts );\n*\n* // Assign each stream to a separate 'debug' namespace...\n* var streams = [];\n* var i;\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( factory( 'stream '+i ) );\n* }\n*/\n\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport objectMode from './object_mode.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'objectMode', objectMode );\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 isFunction from '@stdlib/assert-is-function';\nimport isObject from '@stdlib/assert-is-plain-object';\nimport format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport Stream from './main.js';\n\n\n// MAIN //\n\n/**\n* Returns a debug stream with `objectMode` set to `true`.\n*\n* @param {Options} [options] - stream options\n* @param {string} [options.name] - debug namespace\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.decodeStrings=true] - specifies whether to encode strings as `Buffer` objects before writing data to a returned stream\n* @param {string} [options.defaultEncoding='utf8'] - default encoding when not explicitly specified when writing data\n* @param {Callback} [clbk] - callback to invoke upon receiving data\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} must provide a valid callback argument\n* @returns {DebugSinkStream} debug stream\n*\n* @example\n* var stream = objectMode({\n* 'name': 'my-stream'\n* });\n*\n* stream.write( {'value': 'a'} );\n* stream.write( {'value': 'b'} );\n* stream.write( {'value': 'c'} );\n* stream.end();\n*/\nfunction objectMode( options, clbk ) {\n\tvar opts;\n\tvar cb;\n\tif ( arguments.length > 1 ) {\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\topts = assign( {}, options );\n\t\tcb = clbk;\n\t\tif ( !isFunction( clbk ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Callback argument must be a function. Value: `%s`.', clbk ) );\n\t\t}\n\t} else if ( arguments.length ) {\n\t\tif ( isFunction( options ) ) {\n\t\t\topts = {};\n\t\t\tcb = options;\n\t\t} else {\n\t\t\tif ( !isObject( options ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t\t\t}\n\t\t\topts = assign( {}, options );\n\t\t}\n\t} else {\n\t\topts = {};\n\t}\n\topts.objectMode = true;\n\tif ( cb === void 0 ) {\n\t\treturn new Stream( opts );\n\t}\n\treturn new Stream( opts, cb );\n}\n\n\n// EXPORTS //\n\nexport default objectMode;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport Stream from './main.js';\n\n\n// MAIN //\n\n/**\n* Creates a reusable debug stream factory.\n*\n* @param {Options} [options] - stream options\n* @param {boolean} [options.objectMode=false] - specifies whether the stream should operate in object mode\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.decodeStrings=true] - specifies whether to encode strings as `Buffer` objects before writing data to a returned stream\n* @param {string} [options.defaultEncoding='utf8'] - default encoding when not explicitly specified when writing data\n* @throws {TypeError} options argument must be an object\n* @returns {Function} debug stream factory\n*\n* @example\n* var opts = {\n* 'objectMode': true,\n* 'highWaterMark': 64\n* };\n*\n* var factory = streamFactory( opts );\n*\n* // Assign each stream to a separate debug namespace...\n* var streams = [];\n* var i;\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( factory( 'stream '+i ) );\n* }\n*/\nfunction streamFactory( options ) {\n\tvar opts;\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\topts = assign( {}, options );\n\t} else {\n\t\topts = {};\n\t}\n\treturn debugStream;\n\n\t/**\n\t* Creates a writable stream for debugging stream pipelines.\n\t*\n\t* @private\n\t* @param {string} name - debug namespace\n\t* @param {Callback} [clbk] - callback to invoke upon receiving data\n\t* @throws {TypeError} must provide valid options\n\t* @throws {TypeError} must provide a valid callback argument\n\t* @returns {DebugStream} debug stream\n\t*/\n\tfunction debugStream( name, clbk ) {\n\t\topts.name = name;\n\t\tif ( arguments.length > 1 ) {\n\t\t\treturn new Stream( opts, clbk );\n\t\t}\n\t\treturn new Stream( opts );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default streamFactory;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// MAIN //\n\nvar debug = logger( 'empty-stream' );\n\n\n// EXPORTS //\n\nexport default debug;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar Readable = require( 'readable-stream' ).Readable;\nimport isError from '@stdlib/assert-is-error';\nimport assign from '@stdlib/object-assign';\nimport inherit from '@stdlib/utils-inherit';\nimport setNonEnumerable from '@stdlib/utils-define-nonenumerable-property';\nimport setNonEnumerableReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport nextTick from '@stdlib/utils-next-tick';\nimport DEFAULTS from './defaults.json';\nimport validate from './validate.js';\nimport debug from './debug.js';\n\n\n// FUNCTIONS //\n\n/**\n* Implements the `_read` method.\n*\n* @private\n* @param {number} size - number (of bytes) to read\n* @returns {void}\n*/\nfunction read() {\n\t/* eslint-disable no-invalid-this */\n\tthis.push( null );\n\n\t/* eslint-enable no-invalid-this */\n}\n\n/**\n* Gracefully destroys a stream, providing backward compatibility.\n*\n* @private\n* @param {(string|Object|Error)} [error] - error\n* @returns {EmptyStream} Stream instance\n*/\nfunction destroy( error ) {\n\t/* eslint-disable no-invalid-this */\n\tvar self;\n\tif ( this._destroyed ) {\n\t\tdebug( 'Attempted to destroy an already destroyed stream.' );\n\t\treturn this;\n\t}\n\tself = this;\n\tthis._destroyed = true;\n\n\tnextTick( close );\n\n\treturn this;\n\n\t/**\n\t* Closes a stream.\n\t*\n\t* @private\n\t*/\n\tfunction close() {\n\t\tif ( error ) {\n\t\t\tdebug( 'Stream was destroyed due to an error. Error: %s.', ( isError( error ) ) ? error.message : JSON.stringify( error ) );\n\t\t\tself.emit( 'error', error );\n\t\t}\n\t\tdebug( 'Closing the stream...' );\n\t\tself.emit( 'close' );\n\t}\n\n\t/* eslint-enable no-invalid-this */\n}\n\n\n// MAIN //\n\n/**\n* Stream constructor for creating an \"empty\" stream.\n*\n* @constructor\n* @param {Options} [options] - stream options\n* @param {boolean} [options.objectMode=false] - specifies whether the stream should operate in object mode\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {EmptyStream} Stream instance\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n*\n* function log( chunk ) {\n* console.log( chunk.toString() );\n* }\n*\n* var stream = new EmptyStream();\n*\n* stream.pipe( inspectStream( log ) );\n*/\nfunction EmptyStream( options ) {\n\tvar opts;\n\tvar err;\n\tif ( !( this instanceof EmptyStream ) ) {\n\t\tif ( arguments.length > 0 ) {\n\t\t\treturn new EmptyStream( options );\n\t\t}\n\t\treturn new EmptyStream();\n\t}\n\topts = assign( {}, DEFAULTS );\n\tif ( arguments.length > 0 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t}\n\t// Make the stream a readable stream:\n\tdebug( 'Creating a readable stream configured with the following options: %s.', JSON.stringify( opts ) );\n\tReadable.call( this, opts );\n\n\t// Destruction state:\n\tsetNonEnumerable( this, '_destroyed', false );\n\n\treturn this;\n}\n\n/*\n* Inherit from the `Readable` prototype.\n*/\ninherit( EmptyStream, Readable );\n\n/**\n* Implements the `_read` method.\n*\n* @private\n* @name _read\n* @memberof EmptyStream.prototype\n* @type {Function}\n* @param {number} size - number (of bytes) to read\n* @returns {void}\n*/\nsetNonEnumerableReadOnly( EmptyStream.prototype, '_read', read );\n\n/**\n* Gracefully destroys a stream, providing backward compatibility.\n*\n* @name destroy\n* @memberof EmptyStream.prototype\n* @type {Function}\n* @param {(string|Object|Error)} [error] - error\n* @returns {EmptyStream} Stream instance\n*/\nsetNonEnumerableReadOnly( EmptyStream.prototype, 'destroy', destroy );\n\n\n// EXPORTS //\n\nexport default EmptyStream;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 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 {boolean} [options.objectMode] - specifies whether a stream should operate in object mode\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'objectMode': true\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, 'objectMode' ) ) {\n\t\topts.objectMode = options.objectMode;\n\t\tif ( !isBoolean( opts.objectMode ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'objectMode', opts.objectMode ) );\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/**\n* Create an \"empty\" readable stream.\n*\n* @module @stdlib/streams-node-empty\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n* import emptyStream from '@stdlib/streams-node-empty';\n*\n* function log( chunk ) {\n* console.log( chunk.toString() );\n* }\n*\n* var stream = emptyStream();\n*\n* stream.pipe( inspectStream( log ) );\n*\n* @example\n* import emptyStream from '@stdlib/streams-node-empty';\n*\n* var opts = {\n* 'objectMode': false\n* };\n*\n* var createStream = emptyStream.factory( opts );\n*\n* // Create 10 identically configured streams...\n* var streams = [];\n* var i;\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( createStream() );\n* }\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n* import emptyStream from '@stdlib/streams-node-empty';\n*\n* function log( v ) {\n* console.log( v );\n* }\n*\n* var stream = emptyStream.objectMode();\n*\n* stream.pipe( inspectStream.objectMode( log ) );\n*/\n\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport objectMode from './object_mode.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'objectMode', objectMode );\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 EmptyStream from './main.js';\n\n\n// MAIN //\n\n/**\n* Returns an \"objectMode\" empty readable stream.\n*\n* @returns {EmptyStream} Stream instance\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n*\n* function log( v ) {\n* console.log( v );\n* }\n*\n* var stream = objectMode();\n*\n* stream.pipe( inspectStream.objectMode( log ) );\n*/\nfunction objectMode() {\n\tvar opts = {\n\t\t'objectMode': true\n\t};\n\treturn new EmptyStream( opts );\n}\n\n\n// EXPORTS //\n\nexport default objectMode;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport EmptyStream from './main.js';\n\n\n// MAIN //\n\n/**\n* Returns a function for creating \"empty\" readable streams.\n*\n* @param {Options} [options] - stream options\n* @param {boolean} [options.objectMode=false] - specifies whether a stream should operate in object mode\n* @throws {TypeError} options argument must be an object\n* @returns {Function} stream factory\n*\n* @example\n* var opts = {\n* 'objectMode': false\n* };\n*\n* var createStream = factory( opts );\n*\n* // Create 10 identically configured streams...\n* var streams = [];\n* var i;\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( createStream() );\n* }\n*/\nfunction factory( options ) {\n\tvar opts;\n\tif ( arguments.length > 0 ) {\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\topts = assign( {}, options );\n\t} else {\n\t\topts = {};\n\t}\n\treturn createStream;\n\n\t/**\n\t* Returns an \"empty\" readable stream.\n\t*\n\t* @private\n\t* @throws {TypeError} options argument must be an object\n\t* @throws {TypeError} must provide valid options\n\t* @returns {EmptyStream} Stream instance\n\t*/\n\tfunction createStream() {\n\t\treturn new EmptyStream( opts );\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// 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; // 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* 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 '@stdlib/assert-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 '@stdlib/buffer-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 '@stdlib/buffer-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 '@stdlib/buffer-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 ); // eslint-disable-line no-buffer-constructor\n\t}\n\treturn new Buffer( str, 'utf8' ); // eslint-disable-line no-buffer-constructor\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\nvar logger = require( 'debug' );\n\n\n// MAIN //\n\nvar debug = logger( 'from-array-stream' );\n\n\n// EXPORTS //\n\nexport default debug;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar Readable = require( 'readable-stream' ).Readable;\nimport isCollection from '@stdlib/assert-is-collection';\nimport isError from '@stdlib/assert-is-error';\nimport isBuffer from '@stdlib/assert-is-buffer';\nimport format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport inherit from '@stdlib/utils-inherit';\nimport setNonEnumerable from '@stdlib/utils-define-nonenumerable-property';\nimport setNonEnumerableReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport string2buffer from '@stdlib/buffer-from-string';\nimport Buffer from '@stdlib/buffer-ctor'; // TODO: replace Buffer.concat usage with stdlib pkg\nimport nextTick from '@stdlib/utils-next-tick';\nimport DEFAULTS from './defaults.json';\nimport validate from './validate.js';\nimport debug from './debug.js';\n\n\n// FUNCTIONS //\n\n/**\n* Implements the `_read` method.\n*\n* @private\n* @param {number} size - number (of bytes) to read\n* @returns {void}\n*/\nfunction read() {\n\t/* eslint-disable no-invalid-this */\n\tvar FLG;\n\tvar err;\n\tvar v;\n\n\tif ( this._destroyed ) {\n\t\treturn;\n\t}\n\tFLG = true;\n\twhile ( FLG ) {\n\t\terr = null;\n\n\t\tthis._i += 1;\n\t\tif ( this._i > this._src.length ) {\n\t\t\tdebug( 'Finished iteration.' );\n\t\t\treturn this.push( null );\n\t\t}\n\t\tv = this._src[ this._idx ];\n\t\tdebug( 'Value: %s. Idx: %d. Iter: %d.', JSON.stringify( v ), this._idx, this._i );\n\n\t\tthis._idx += this._stride;\n\t\tif ( this._objectMode === false ) {\n\t\t\tv = this._serialize( v );\n\t\t\tif ( typeof v === 'string' ) {\n\t\t\t\tif ( this._i === 1 ) {\n\t\t\t\t\tv = string2buffer( v );\n\t\t\t\t} else {\n\t\t\t\t\tv = string2buffer( this._sep+v );\n\t\t\t\t}\n\t\t\t} else if ( isBuffer( v ) ) {\n\t\t\t\tif ( this._i > 1 ) {\n\t\t\t\t\tv = Buffer.concat( [ string2buffer( this._sep ), v ] );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\terr = new Error( format( 'invalid operation. Serialization function must return a string or Buffer. Value: `%s`.', v ) );\n\t\t\t}\n\t\t}\n\t\tif ( err ) {\n\t\t\tthis.emit( 'error', err );\n\t\t} else {\n\t\t\tFLG = this.push( v );\n\t\t}\n\t}\n\n\t/* eslint-enable no-invalid-this */\n}\n\n/**\n* Gracefully destroys a stream, providing backward compatibility.\n*\n* @private\n* @param {(string|Object|Error)} [error] - error\n* @returns {ArrayStream} Stream instance\n*/\nfunction destroy( error ) {\n\t/* eslint-disable no-invalid-this */\n\tvar self;\n\tif ( this._destroyed ) {\n\t\tdebug( 'Attempted to destroy an already destroyed stream.' );\n\t\treturn this;\n\t}\n\tself = this;\n\tthis._destroyed = true;\n\n\tnextTick( close );\n\n\treturn this;\n\n\t/**\n\t* Closes a stream.\n\t*\n\t* @private\n\t*/\n\tfunction close() {\n\t\tif ( error ) {\n\t\t\tdebug( 'Stream was destroyed due to an error. Error: %s.', ( isError( error ) ) ? error.message : JSON.stringify( error ) );\n\t\t\tself.emit( 'error', error );\n\t\t}\n\t\tdebug( 'Closing the stream...' );\n\t\tself.emit( 'close' );\n\t}\n\n\t/* eslint-enable no-invalid-this */\n}\n\n\n// MAIN //\n\n/**\n* Stream constructor for generating a readable stream from an array-like object.\n*\n* @constructor\n* @param {Collection} src - source array-like object\n* @param {Options} [options] - stream options\n* @param {boolean} [options.objectMode=false] - specifies whether the stream should operate in object mode\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to strings\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the maximum number of bytes to store in an internal buffer before pausing streaming\n* @param {string} [options.sep='\\n'] - separator used to join streamed data\n* @param {Function} [options.serialize] - custom serialization function\n* @param {integer} [options.dir=1] - iteration direction\n* @throws {TypeError} first argument must be an array-like object\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {ArrayStream} Stream instance\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n* import Float64Array from '@stdlib/array-float64';\n* import randu from '@stdlib/random-base-randu';\n*\n* function log( chunk ) {\n* console.log( chunk.toString() );\n* }\n*\n* var arr = new Float64Array( 10 );\n* var i;\n* for ( i = 0; i < arr.length; i++ ) {\n* arr[ i ] = randu();\n* }\n*\n* var stream = new ArrayStream( arr );\n*\n* stream.pipe( inspectStream( log ) );\n*/\nfunction ArrayStream( src, options ) {\n\tvar opts;\n\tvar err;\n\tif ( !( this instanceof ArrayStream ) ) {\n\t\tif ( arguments.length > 1 ) {\n\t\t\treturn new ArrayStream( src, options );\n\t\t}\n\t\treturn new ArrayStream( src );\n\t}\n\tif ( !isCollection( src ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an array-like object. Value: `%s`.', src ) );\n\t}\n\topts = assign( {}, DEFAULTS );\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\t// Make the stream a readable stream:\n\tdebug( 'Creating a readable stream configured with the following options: %s.', JSON.stringify( opts ) );\n\tReadable.call( this, opts );\n\n\t// Destruction state:\n\tsetNonEnumerable( this, '_destroyed', false );\n\n\t// Cache whether the stream is operating in object mode:\n\tsetNonEnumerableReadOnly( this, '_objectMode', opts.objectMode );\n\n\t// Cache the separator:\n\tsetNonEnumerableReadOnly( this, '_sep', opts.sep );\n\n\t// Define the serialization function:\n\tsetNonEnumerableReadOnly( this, '_serialize', opts.serialize || JSON.stringify );\n\n\t// Cache the data source:\n\tsetNonEnumerableReadOnly( this, '_src', src );\n\n\t// Cache the array \"stride\":\n\tsetNonEnumerableReadOnly( this, '_stride', opts.dir );\n\n\t// Initialize an iteration counter:\n\tsetNonEnumerable( this, '_i', 0 );\n\n\t// Initialize the source index (pointer):\n\tsetNonEnumerable( this, '_idx', ( opts.dir === 1 ) ? 0 : src.length-1 );\n\n\treturn this;\n}\n\n/*\n* Inherit from the `Readable` prototype.\n*/\ninherit( ArrayStream, Readable );\n\n/**\n* Implements the `_read` method.\n*\n* @private\n* @name _read\n* @memberof ArrayStream.prototype\n* @type {Function}\n* @param {number} size - number (of bytes) to read\n* @returns {void}\n*/\nsetNonEnumerableReadOnly( ArrayStream.prototype, '_read', read );\n\n/**\n* Gracefully destroys a stream, providing backward compatibility.\n*\n* @name destroy\n* @memberof ArrayStream.prototype\n* @type {Function}\n* @param {(string|Object|Error)} [error] - error\n* @returns {ArrayStream} Stream instance\n*/\nsetNonEnumerableReadOnly( ArrayStream.prototype, 'destroy', destroy );\n\n\n// EXPORTS //\n\nexport default ArrayStream;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isNonNegative } from '@stdlib/assert-is-nonnegative-number';\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport isFunction from '@stdlib/assert-is-function';\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.sep] - separator used to join streamed data\n* @param {boolean} [options.objectMode] - specifies whether a stream should operate in object mode\n* @param {(string|null)} [options.encoding] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the maximum number of bytes to store in the internal buffer before pausing streaming\n* @param {Function} [options.serialize] - custom serialization function\n* @param {integer} [options.dir] - iteration direction\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'objectMode': true\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, 'sep' ) ) {\n\t\topts.sep = options.sep;\n\t\tif ( !isString( opts.sep ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'sep', opts.sep ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'objectMode' ) ) {\n\t\topts.objectMode = options.objectMode;\n\t\tif ( !isBoolean( opts.objectMode ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'objectMode', opts.objectMode ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'encoding' ) ) {\n\t\topts.encoding = options.encoding;\n\t\tif ( !isString( opts.encoding ) && opts.encoding !== null ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a string or null. Option: `%s`.', 'encoding', opts.encoding ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'highWaterMark' ) ) {\n\t\topts.highWaterMark = options.highWaterMark;\n\t\tif ( !isNonNegative( opts.highWaterMark ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a nonnegative number. Option: `%s`.', 'highWaterMark', opts.highWaterMark ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'serialize' ) ) {\n\t\topts.serialize = options.serialize;\n\t\tif ( !isFunction( opts.serialize ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a function. Option: `%s`.', 'serialize', opts.serialize ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'dir' ) ) {\n\t\topts.dir = options.dir;\n\t\tif ( opts.dir !== 1 && opts.dir !== -1 ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be either `1` or `-1`. Option: `%s`.', 'dir', opts.dir ) );\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/**\n* Create a readable stream from an array-like object.\n*\n* @module @stdlib/streams-node-from-array\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n* import Float64Array from '@stdlib/array-float64';\n* import randu from '@stdlib/random-base-randu';\n* import arrayStream from '@stdlib/streams-node-from-array';\n*\n* function log( chunk ) {\n* console.log( chunk.toString() );\n* }\n*\n* var arr = new Float64Array( 10 );\n* var i;\n* for ( i = 0; i < arr.length; i++ ) {\n* arr[ i ] = randu();\n* }\n*\n* var stream = arrayStream( arr );\n*\n* stream.pipe( inspectStream( log ) );\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n* import randu from '@stdlib/random-base-randu';\n* import arrayStream from '@stdlib/streams-node-from-array';\n*\n* var arr = new Float64Array( 10 );\n* var i;\n* for ( i = 0; i < arr.length; i++ ) {\n* arr[ i ] = randu();\n* }\n*\n* var opts = {\n* 'sep': ',',\n* 'objectMode': false,\n* 'encoding': 'utf8',\n* 'highWaterMark': 64\n* };\n*\n* var createStream = arrayStream.factory( opts );\n*\n* // Create 10 identically configured streams...\n* var streams = [];\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( createStream( arr ) );\n* }\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n* import Float64Array from '@stdlib/array-float64';\n* import randu from '@stdlib/random-base-randu';\n* import arrayStream from '@stdlib/streams-node-from-array';\n*\n* function log( v ) {\n* console.log( v );\n* }\n*\n* var arr = new Float64Array( 10 );\n* var i;\n* for ( i = 0; i < arr.length; i++ ) {\n* arr[ i ] = randu();\n* }\n*\n* var stream = arrayStream.objectMode( arr );\n*\n* stream.pipe( inspectStream.objectMode( log ) );\n*/\n\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport objectMode from './object_mode.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'objectMode', objectMode );\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 isObject from '@stdlib/assert-is-plain-object';\nimport format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport ArrayStream from './main.js';\n\n\n// MAIN //\n\n/**\n* Returns an \"objectMode\" readable stream from an array-like object.\n*\n* @param {Collection} src - source array-like object\n* @param {Options} [options] - stream options\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the maximum number of objects to store in an internal buffer before pausing streaming\n* @param {integer} [options.dir=1] - iteration direction\n* @throws {TypeError} first argument must be an array-like object\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {ArrayStream} Stream instance\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n* import Float64Array from '@stdlib/array-float64';\n* import randu from '@stdlib/random-base-randu';\n*\n* function log( v ) {\n* console.log( v );\n* }\n*\n* var arr = new Float64Array( 10 );\n* var i;\n* for ( i = 0; i < arr.length; i++ ) {\n* arr[ i ] = randu();\n* }\n*\n* var stream = objectMode( arr );\n*\n* stream.pipe( inspectStream.objectMode( log ) );\n*/\nfunction objectMode( src, options ) {\n\tvar opts;\n\tif ( arguments.length > 1 ) {\n\t\topts = options;\n\t\tif ( !isObject( opts ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', opts ) );\n\t\t}\n\t\topts = assign( {}, options );\n\t} else {\n\t\topts = {};\n\t}\n\topts.objectMode = true;\n\treturn new ArrayStream( src, opts );\n}\n\n\n// EXPORTS //\n\nexport default objectMode;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport ArrayStream from './main.js';\n\n\n// MAIN //\n\n/**\n* Returns a function for creating readable streams from array-like objects.\n*\n* @param {Options} [options] - stream options\n* @param {boolean} [options.objectMode=false] - specifies whether a stream should operate in object mode\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the maximum number of bytes to store in an internal buffer before pausing streaming\n* @param {string} [options.sep='\\n'] - separator used to join streamed data\n* @param {Function} [options.serialize] - custom serialization function\n* @param {integer} [options.dir=1] - iteration direction\n* @throws {TypeError} options argument must be an object\n* @returns {Function} stream factory\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n* import randu from '@stdlib/random-base-randu';\n*\n* var arr = new Float64Array( 10 );\n* var i;\n* for ( i = 0; i < arr.length; i++ ) {\n* arr[ i ] = randu();\n* }\n*\n* var opts = {\n* 'sep': ',',\n* 'objectMode': false,\n* 'encoding': 'utf8',\n* 'highWaterMark': 64\n* };\n*\n* var createStream = factory( opts );\n*\n* // Create 10 identically configured streams...\n* var streams = [];\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( createStream( arr ) );\n* }\n*/\nfunction factory( options ) {\n\tvar opts;\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\topts = assign( {}, options );\n\t} else {\n\t\topts = {};\n\t}\n\treturn createStream;\n\n\t/**\n\t* Returns a readable stream from an array-like object.\n\t*\n\t* @private\n\t* @param {Collection} src - source array-like object\n\t* @throws {TypeError} must provide an array-like object\n\t* @throws {TypeError} options argument must be an object\n\t* @throws {TypeError} must provide valid options\n\t* @returns {ArrayStream} Stream instance\n\t*/\n\tfunction createStream( src ) {\n\t\treturn new ArrayStream( src, opts );\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 { isPrimitive as isInteger } from '@stdlib/assert-is-integer';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number primitive having a nonnegative integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number primitive having a nonnegative integer value\n*\n* @example\n* var bool = isNonNegativeInteger( 3.0 );\n* // returns true\n*\n* @example\n* var bool = isNonNegativeInteger( new Number( 3.0 ) );\n* // returns false\n*/\nfunction isNonNegativeInteger( value ) {\n\treturn (\n\t\tisInteger( value ) &&\n\t\tvalue >= 0\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isNonNegativeInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isObject as isInteger } from '@stdlib/assert-is-integer';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object having a nonnegative integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object having a nonnegative integer value\n*\n* @example\n* var bool = isNonNegativeInteger( 3.0 );\n* // returns false\n*\n* @example\n* var bool = isNonNegativeInteger( new Number( 3.0 ) );\n* // returns true\n*/\nfunction isNonNegativeInteger( value ) {\n\treturn (\n\t\tisInteger( value ) &&\n\t\tvalue.valueOf() >= 0\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isNonNegativeInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isPrimitive from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a nonnegative integer.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a nonnegative integer\n*\n* @example\n* var bool = isNonNegativeInteger( 5.0 );\n* // returns true\n*\n* @example\n* var bool = isNonNegativeInteger( new Number( 5.0 ) );\n* // returns true\n*\n* @example\n* var bool = isNonNegativeInteger( -5.0 );\n* // returns false\n*\n* @example\n* var bool = isNonNegativeInteger( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isNonNegativeInteger( null );\n* // returns false\n*/\nfunction isNonNegativeInteger( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nexport default isNonNegativeInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Test if a value is 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// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// MAIN //\n\nvar debug = logger( 'from-circular-array-stream' );\n\n\n// EXPORTS //\n\nexport default debug;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar Readable = require( 'readable-stream' ).Readable;\nimport isCollection from '@stdlib/assert-is-collection';\nimport isError from '@stdlib/assert-is-error';\nimport isBuffer from '@stdlib/assert-is-buffer';\nimport assign from '@stdlib/object-assign';\nimport inherit from '@stdlib/utils-inherit';\nimport setNonEnumerable from '@stdlib/utils-define-nonenumerable-property';\nimport setNonEnumerableReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport string2buffer from '@stdlib/buffer-from-string';\nimport Buffer from '@stdlib/buffer-ctor'; // TODO: replace Buffer.concat usage with stdlib pkg\nimport nextTick from '@stdlib/utils-next-tick';\nimport format from '@stdlib/string-format';\nimport DEFAULTS from './defaults.json';\nimport validate from './validate.js';\nimport debug from './debug.js';\n\n\n// FUNCTIONS //\n\n/**\n* Implements the `_read` method.\n*\n* @private\n* @param {number} size - number (of bytes) to read\n* @returns {void}\n*/\nfunction read() {\n\t/* eslint-disable no-invalid-this */\n\tvar FLG;\n\tvar err;\n\tvar v;\n\n\tif ( this._destroyed ) {\n\t\treturn;\n\t}\n\tFLG = true;\n\twhile ( FLG ) {\n\t\terr = null;\n\n\t\tthis._i += 1;\n\t\tif ( this._i > this._iter || this._src.length === 0 ) {\n\t\t\tdebug( 'Finished iteration.' );\n\t\t\treturn this.push( null );\n\t\t}\n\t\tthis._idx += this._stride;\n\t\tif ( this._stride > 0 && this._idx >= this._src.length ) {\n\t\t\tthis._idx %= this._src.length;\n\t\t} else if ( this._stride < 0 && this._idx < 0 ) {\n\t\t\tthis._idx += this._src.length;\n\t\t}\n\t\tv = this._src[ this._idx ];\n\t\tdebug( 'Value: %s. Idx: %d. Iter: %d.', JSON.stringify( v ), this._idx, this._i );\n\n\t\tif ( this._objectMode === false ) {\n\t\t\tv = this._serialize( v );\n\t\t\tif ( typeof v === 'string' ) {\n\t\t\t\tif ( this._i === 1 ) {\n\t\t\t\t\tv = string2buffer( v );\n\t\t\t\t} else {\n\t\t\t\t\tv = string2buffer( this._sep+v );\n\t\t\t\t}\n\t\t\t} else if ( isBuffer( v ) ) {\n\t\t\t\tif ( this._i > 1 ) {\n\t\t\t\t\tv = Buffer.concat( [ string2buffer( this._sep ), v ] );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\terr = new Error( format( 'invalid operation. Serialization function must return a string or Buffer. Value: `%s`.', v ) );\n\t\t\t}\n\t\t}\n\t\tif ( err ) {\n\t\t\tthis.emit( 'error', err );\n\t\t} else {\n\t\t\tFLG = this.push( v );\n\t\t}\n\t}\n\n\t/* eslint-enable no-invalid-this */\n}\n\n/**\n* Gracefully destroys a stream, providing backward compatibility.\n*\n* @private\n* @param {(string|Object|Error)} [error] - error\n* @returns {CircularArrayStream} Stream instance\n*/\nfunction destroy( error ) {\n\t/* eslint-disable no-invalid-this */\n\tvar self;\n\tif ( this._destroyed ) {\n\t\tdebug( 'Attempted to destroy an already destroyed stream.' );\n\t\treturn this;\n\t}\n\tself = this;\n\tthis._destroyed = true;\n\n\tnextTick( close );\n\n\treturn this;\n\n\t/**\n\t* Closes a stream.\n\t*\n\t* @private\n\t*/\n\tfunction close() {\n\t\tif ( error ) {\n\t\t\tdebug( 'Stream was destroyed due to an error. Error: %s.', ( isError( error ) ) ? error.message : JSON.stringify( error ) );\n\t\t\tself.emit( 'error', error );\n\t\t}\n\t\tdebug( 'Closing the stream...' );\n\t\tself.emit( 'close' );\n\t}\n\n\t/* eslint-enable no-invalid-this */\n}\n\n\n// MAIN //\n\n/**\n* Stream constructor for generating a readable stream from an array-like object which repeatedly iterates over a provided value's elements.\n*\n* @constructor\n* @param {Collection} src - source array-like object\n* @param {Options} [options] - stream options\n* @param {boolean} [options.objectMode=false] - specifies whether the stream should operate in object mode\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to strings\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the maximum number of bytes to store in an internal buffer before pausing streaming\n* @param {string} [options.sep='\\n'] - separator used to join streamed data\n* @param {Function} [options.serialize] - custom serialization function\n* @param {NonNegativeInteger} [options.iter=1e308] - number of iterations\n* @param {integer} [options.dir=1] - iteration direction\n* @throws {TypeError} first argument must be an array-like object\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {CircularArrayStream} Stream instance\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n* import Float64Array from '@stdlib/array-float64';\n* import randu from '@stdlib/random-base-randu';\n*\n* function log( chunk ) {\n* console.log( chunk.toString() );\n* }\n*\n* var arr = new Float64Array( 10 );\n* var i;\n* for ( i = 0; i < arr.length; i++ ) {\n* arr[ i ] = randu();\n* }\n*\n* var opts = {\n* 'iter': arr.length * 2\n* };\n*\n* var stream = new CircularArrayStream( arr, opts );\n*\n* stream.pipe( inspectStream( log ) );\n*/\nfunction CircularArrayStream( src, options ) {\n\tvar opts;\n\tvar err;\n\tif ( !( this instanceof CircularArrayStream ) ) {\n\t\tif ( arguments.length > 1 ) {\n\t\t\treturn new CircularArrayStream( src, options );\n\t\t}\n\t\treturn new CircularArrayStream( src );\n\t}\n\tif ( !isCollection( src ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an array-like object. Value: `%s`.', src ) );\n\t}\n\topts = assign( {}, DEFAULTS );\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\t// Make the stream a readable stream:\n\tdebug( 'Creating a readable stream configured with the following options: %s.', JSON.stringify( opts ) );\n\tReadable.call( this, opts );\n\n\t// Destruction state:\n\tsetNonEnumerable( this, '_destroyed', false );\n\n\t// Cache whether the stream is operating in object mode:\n\tsetNonEnumerableReadOnly( this, '_objectMode', opts.objectMode );\n\n\t// Cache the separator:\n\tsetNonEnumerableReadOnly( this, '_sep', opts.sep );\n\n\t// Define the serialization function:\n\tsetNonEnumerableReadOnly( this, '_serialize', opts.serialize || JSON.stringify );\n\n\t// Cache the data source:\n\tsetNonEnumerableReadOnly( this, '_src', src );\n\n\t// Cache the array \"stride\":\n\tsetNonEnumerableReadOnly( this, '_stride', opts.dir );\n\n\t// Cache the number of iterations:\n\tsetNonEnumerableReadOnly( this, '_iter', opts.iter );\n\n\t// Initialize an iteration counter:\n\tsetNonEnumerable( this, '_i', 0 );\n\n\t// Initialize the source index (pointer):\n\tsetNonEnumerable( this, '_idx', ( opts.dir === 1 ) ? -1 : src.length );\n\n\treturn this;\n}\n\n/*\n* Inherit from the `Readable` prototype.\n*/\ninherit( CircularArrayStream, Readable );\n\n/**\n* Implements the `_read` method.\n*\n* @private\n* @name _read\n* @memberof CircularArrayStream.prototype\n* @type {Function}\n* @param {number} size - number (of bytes) to read\n* @returns {void}\n*/\nsetNonEnumerableReadOnly( CircularArrayStream.prototype, '_read', read );\n\n/**\n* Gracefully destroys a stream, providing backward compatibility.\n*\n* @name destroy\n* @memberof CircularArrayStream.prototype\n* @type {Function}\n* @param {(string|Object|Error)} [error] - error\n* @returns {CircularArrayStream} Stream instance\n*/\nsetNonEnumerableReadOnly( CircularArrayStream.prototype, 'destroy', destroy );\n\n\n// EXPORTS //\n\nexport default CircularArrayStream;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isNonNegative } from '@stdlib/assert-is-nonnegative-number';\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert-is-nonnegative-integer';\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport isFunction from '@stdlib/assert-is-function';\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.sep] - separator used to join streamed data\n* @param {boolean} [options.objectMode] - specifies whether a stream should operate in object mode\n* @param {(string|null)} [options.encoding] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the maximum number of bytes to store in the internal buffer before pausing streaming\n* @param {Function} [options.serialize] - custom serialization function\n* @param {NonNegativeInteger} [options.iter=1e308] - number of iterations\n* @param {integer} [options.dir] - iteration direction\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'objectMode': true\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, 'sep' ) ) {\n\t\topts.sep = options.sep;\n\t\tif ( !isString( opts.sep ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'sep', opts.sep ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'objectMode' ) ) {\n\t\topts.objectMode = options.objectMode;\n\t\tif ( !isBoolean( opts.objectMode ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'objectMode', opts.objectMode ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'encoding' ) ) {\n\t\topts.encoding = options.encoding;\n\t\tif ( !isString( opts.encoding ) && opts.encoding !== null ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a string or null. Option: `%s`.', 'encoding', opts.encoding ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'highWaterMark' ) ) {\n\t\topts.highWaterMark = options.highWaterMark;\n\t\tif ( !isNonNegative( opts.highWaterMark ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a nonnegative number. Option: `%s`.', 'highWaterMark', opts.highWaterMark ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'serialize' ) ) {\n\t\topts.serialize = options.serialize;\n\t\tif ( !isFunction( opts.serialize ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a function. Option: `%s`.', 'serialize', opts.serialize ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'iter' ) ) {\n\t\topts.iter = options.iter;\n\t\tif ( !isNonNegativeInteger( opts.iter ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a nonnegative integer. Option: `%s`.', 'iter', opts.iter ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'dir' ) ) {\n\t\topts.dir = options.dir;\n\t\tif ( opts.dir !== 1 && opts.dir !== -1 ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be either `1` or `-1`. Option: `%s`.', 'dir', opts.dir ) );\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/**\n* Create a readable stream from an array-like object which repeatedly iterates over a provided value's elements.\n*\n* @module @stdlib/streams-node-from-circular-array\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n* import Float64Array from '@stdlib/array-float64';\n* import randu from '@stdlib/random-base-randu';\n* import circularArrayStream from '@stdlib/streams-node-from-circular-array';\n*\n* function log( chunk ) {\n* console.log( chunk.toString() );\n* }\n*\n* var arr = new Float64Array( 10 );\n* var i;\n* for ( i = 0; i < arr.length; i++ ) {\n* arr[ i ] = randu();\n* }\n*\n* var opts = {\n* 'iter': arr.length * 2\n* };\n*\n* var stream = circularArrayStream( arr, opts );\n*\n* stream.pipe( inspectStream( log ) );\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n* import randu from '@stdlib/random-base-randu';\n* import circularArrayStream from '@stdlib/streams-node-from-circular-array';\n*\n* var arr = new Float64Array( 10 );\n* var i;\n* for ( i = 0; i < arr.length; i++ ) {\n* arr[ i ] = randu();\n* }\n*\n* var opts = {\n* 'sep': ',',\n* 'objectMode': false,\n* 'encoding': 'utf8',\n* 'highWaterMark': 64\n* };\n*\n* var createStream = circularArrayStream.factory( opts );\n*\n* // Create 10 identically configured streams...\n* var streams = [];\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( createStream( arr ) );\n* }\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n* import Float64Array from '@stdlib/array-float64';\n* import randu from '@stdlib/random-base-randu';\n* import circularArrayStream from '@stdlib/streams-node-from-circular-array';\n*\n* function log( v ) {\n* console.log( v );\n* }\n*\n* var arr = new Float64Array( 10 );\n* var i;\n* for ( i = 0; i < arr.length; i++ ) {\n* arr[ i ] = randu();\n* }\n*\n* var opts = {\n* 'iter': arr.length * 2\n* };\n*\n* var stream = circularArrayStream.objectMode( arr, opts );\n*\n* stream.pipe( inspectStream.objectMode( log ) );\n*/\n\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport objectMode from './object_mode.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'objectMode', objectMode );\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 isObject from '@stdlib/assert-is-plain-object';\nimport format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport CircularArrayStream from './main.js';\n\n\n// MAIN //\n\n/**\n* Returns an \"objectMode\" readable stream from an array-like object which repeatedly iterates over a provided value's elements.\n*\n* @param {Collection} src - source array-like object\n* @param {Options} [options] - stream options\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the maximum number of objects to store in an internal buffer before pausing streaming\n* @param {NonNegativeInteger} [options.iter=1e308] - number of iterations\n* @param {integer} [options.dir=1] - iteration direction\n* @throws {TypeError} first argument must be an array-like object\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {CircularArrayStream} Stream instance\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n* import Float64Array from '@stdlib/array-float64';\n* import randu from '@stdlib/random-base-randu';\n*\n* function log( v ) {\n* console.log( v );\n* }\n*\n* var arr = new Float64Array( 10 );\n* var i;\n* for ( i = 0; i < arr.length; i++ ) {\n* arr[ i ] = randu();\n* }\n*\n* var opts = {\n* 'iter': arr.length * 2\n* };\n*\n* var stream = objectMode( arr, opts );\n*\n* stream.pipe( inspectStream.objectMode( log ) );\n*/\nfunction objectMode( src, options ) {\n\tvar opts;\n\tif ( arguments.length > 1 ) {\n\t\topts = options;\n\t\tif ( !isObject( opts ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', opts ) );\n\t\t}\n\t\topts = assign( {}, options );\n\t} else {\n\t\topts = {};\n\t}\n\topts.objectMode = true;\n\treturn new CircularArrayStream( src, opts );\n}\n\n\n// EXPORTS //\n\nexport default objectMode;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport CircularArrayStream from './main.js';\n\n\n// MAIN //\n\n/**\n* Returns a function for creating readable streams from circular array-like objects.\n*\n* @param {Options} [options] - stream options\n* @param {boolean} [options.objectMode=false] - specifies whether a stream should operate in object mode\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the maximum number of bytes to store in an internal buffer before pausing streaming\n* @param {string} [options.sep='\\n'] - separator used to join streamed data\n* @param {Function} [options.serialize] - custom serialization function\n* @param {integer} [options.iter=1e308] - number of iterations\n* @param {integer} [options.dir=1] - iteration direction\n* @throws {TypeError} options argument must be an object\n* @returns {Function} stream factory\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n* import randu from '@stdlib/random-base-randu';\n*\n* var arr = new Float64Array( 10 );\n* var i;\n* for ( i = 0; i < arr.length; i++ ) {\n* arr[ i ] = randu();\n* }\n*\n* var opts = {\n* 'sep': ',',\n* 'objectMode': false,\n* 'encoding': 'utf8',\n* 'highWaterMark': 64\n* };\n*\n* var createStream = factory( opts );\n*\n* // Create 10 identically configured streams...\n* var streams = [];\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( createStream( arr ) );\n* }\n*/\nfunction factory( options ) {\n\tvar opts;\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\topts = assign( {}, options );\n\t} else {\n\t\topts = {};\n\t}\n\treturn createStream;\n\n\t/**\n\t* Returns a readable stream from a circular array-like object.\n\t*\n\t* @private\n\t* @param {Collection} src - source array-like object\n\t* @throws {TypeError} must provide an array-like object\n\t* @throws {TypeError} options argument must be an object\n\t* @throws {TypeError} must provide valid options\n\t* @returns {CircularArrayStream} Stream instance\n\t*/\n\tfunction createStream( src ) {\n\t\treturn new CircularArrayStream( src, opts );\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 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* 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) 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// VARIABLES //\n\nvar toStr = Object.prototype.toString;\n\n\n// MAIN //\n\n/**\n* Returns the internal class of a provided value.\n*\n* @private\n* @param {*} value - input value\n* @returns {string} internal class\n*/\nfunction toString( value ) { // eslint-disable-line stdlib/no-redeclare\n\treturn toStr.call( value );\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// VARIABLES //\n\nvar Global;\n\n\n// FUNCTIONS //\n\n/**\n* Test if the global scope is bound to the \"global\" variable present in Node.js environments. When creating a new function using the `Function(){}` constructor, the execution scope aliased by the `this` variable is the global scope.\n*\n* @private\n* @returns {boolean} boolean indicating if global scope is bound to \"global\" variable\n*/\nfunction globalScope() {\n\tvar fcn = '';\n\tfcn += 'try {';\n\tfcn += 'return this === global;';\n\tfcn += '} catch ( err ) {';\n\tfcn += 'return false;';\n\tfcn += '}';\n\treturn (new Function( fcn ))(); // eslint-disable-line no-new-func, stdlib/require-globals\n}\n\n\n// MAIN //\n\nGlobal = globalScope();\n\n\n// EXPORTS //\n\nexport default Global;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar proc = require( 'process' );\nimport getGlobal from '@stdlib/utils-global';\nimport nativeClass from '@stdlib/utils-native-class';\nimport isObject from '@stdlib/assert-is-plain-object';\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport toStr from './to_string.js';\nimport globalScope from './global_scope.js';\n\n\n// VARIABLES //\n\nvar Global = getGlobal();\nvar RE = /node|io\\.js/;\n\n\n// MAIN //\n\n/**\n* Returns a boolean indicating if the runtime is Node.js.\n*\n* @returns {boolean} boolean indicating if runtime is Node.js\n*\n* @example\n* var bool = isNode();\n* // returns \n*/\nfunction isNode() {\n\treturn (\n\t\t// Check for presence of `global` variable:\n\t\ttypeof global === 'object' &&\n\n\t\t// Check that the `global` variable matches the determined global variable:\n\t\tglobal === Global &&\n\n\t\t// Check for a circular reference to the global variable:\n\t\tGlobal === Global.global &&\n\n\t\t// Check that the global variable has the expected internal class:\n\t\t(\n\t\t\t// Node < v7\n\t\t\tnativeClass( Global ) === '[object global]' ||\n\n\t\t\t// Node >= v7 (https://github.com/nodejs/node/issues/9274)\n\t\t\tnativeClass( Global ) === '[object Object]'\n\t\t) &&\n\n\t\t// Check that the `global` variable is equal to the global scope:\n\t\tglobalScope === true &&\n\n\t\t// Check for a `require` global variable:\n\t\ttypeof require === 'function' &&\n\n\t\t// Check for a `process` global variable:\n\t\ttypeof proc === 'object' &&\n\n\t\t// Check that the `process` global variable has the expected internal class (NOTE: we use `toStr`, rather than `nativecClass` to address changes introduced in Node >= v14.6.0; see https://github.com/stdlib-js/stdlib/issues/375):\n\t\ttoStr( proc ) === '[object process]' &&\n\n\t\t// Check for a `versions` property:\n\t\tisObject( proc.versions ) &&\n\n\t\t// Check for a `node` property:\n\t\tisString( proc.versions.node ) &&\n\n\t\t/* eslint-disable node/no-unsupported-features/es-builtins */\n\t\t(\n\t\t\t// `process.release` was added in Node v3.0.0 via io.js:\n\t\t\ttypeof proc.release === 'undefined' ||\n\n\t\t\t(\n\t\t\t\t// Check for a `release` property:\n\t\t\t\tisObject( proc.release ) &&\n\n\t\t\t\t// Check for a `name` property:\n\t\t\t\tisString( proc.release.name ) &&\n\n\t\t\t\t// Check that the release name contains either `node` or `io.js` (in Node.js/io.js, the release name is read-only):\n\t\t\t\tRE.test( proc.release.name )\n\t\t\t)\n\t\t)\n\t\t/* eslint-enable node/no-unsupported-features/es-builtins */\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isNode;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Boolean indicating if the runtime is Node.js.\n*\n* @module @stdlib/assert-is-node\n*\n* @example\n* import IS_NODE from '@stdlib/assert-is-node';\n*\n* var bool = IS_NODE;\n* // returns \n*/\n\n// MODULES //\n\nimport main from './main.js';\n\n\n// MAIN //\n\nvar bool = main();\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/**\n* Node version.\n*\n* @module @stdlib/process-node-version\n*\n* @example\n* var semver = require( 'semver' );\n* import VERSION from '@stdlib/process-node-version';\n*\n* if ( semver.lt( VERSION, '1.0.0' ) ) {\n* console.log( 'Running on a pre-io.js version...' );\n* }\n* else if ( semver.lt( VERSION, '4.0.0' ) ) {\n* console.log( 'Running on an io.js version...' );\n* }\n* else {\n* console.log( 'Running on a post-io.js version...' );\n* }\n*/\n\n// MODULES //\n\nimport IS_NODE from '@stdlib/assert-is-node';\nimport node from './main.js';\nimport browser from './browser.js';\n\n\n// MAIN //\n\nvar VERSION;\nif ( IS_NODE ) {\n\tVERSION = node;\n} else {\n\tVERSION = browser;\n}\n\n\n// EXPORTS //\n\nexport default VERSION;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport proc from './process.js';\n\n\n// MAIN //\n\n/**\n* Node version.\n*\n* @constant\n* @type {string}\n*/\nvar VERSION = proc.versions.node;\n\n\n// EXPORTS //\n\nexport default VERSION;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar proc = require( 'process' );\n\n\n// EXPORTS //\n\nexport default proc;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport NODE_VERSION from '@stdlib/process-node-version';\n\n\n// MAIN //\n\nvar MAJOR = ( NODE_VERSION ) ? parseInt( NODE_VERSION.split( '.' )[ 0 ], 10 ) : -1;\n\n\n// EXPORTS //\n\nexport default MAJOR;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 null;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 '@stdlib/buffer-ctor';\nimport version from './node_version.js';\n\n\n// MAIN //\n\nvar bool = isFunction( Buffer.from ) && version >= 5;\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 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/**\n* Maximum unsigned 8-bit integer.\n*\n* @module @stdlib/constants-uint8-max\n* @type {integer32}\n*\n* @example\n* import UINT8_MAX from '@stdlib/constants-uint8-max';\n* // returns 255\n*/\n\n\n// MAIN //\n\n/**\n* Maximum unsigned 8-bit integer.\n*\n* ## Notes\n*\n* The number has the value\n*\n* ```tex\n* 2^{8} - 1\n* ```\n*\n* which corresponds to the bit sequence\n*\n* ```binarystring\n* 11111111\n* ```\n*\n* @constant\n* @type {integer32}\n* @default 255\n*/\nvar UINT8_MAX = 255|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default UINT8_MAX;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\nvar main = ( typeof Uint8Array === 'function' ) ? Uint8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\nvar ctor = ( typeof Uint8Array === 'function' ) ? Uint8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Typed array constructor which returns a typed array representing an array of 8-bit unsigned integers in the platform byte order.\n*\n* @module @stdlib/array-uint8\n*\n* @example\n* import ctor from '@stdlib/array-uint8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasUint8ArraySupport from '@stdlib/assert-has-uint8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasUint8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isUint8Array from '@stdlib/assert-is-uint8array';\nimport UINT8_MAX from '@stdlib/constants-uint8-max';\nimport GlobalUint8Array from './uint8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Uint8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Uint8Array` support\n*\n* @example\n* var bool = hasUint8ArraySupport();\n* // returns \n*/\nfunction hasUint8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalUint8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = [ 1, 3.14, -3.14, UINT8_MAX+1, UINT8_MAX+2 ];\n\t\tarr = new GlobalUint8Array( arr );\n\t\tbool = (\n\t\t\tisUint8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === UINT8_MAX-2 && // truncation and wrap around\n\t\t\tarr[ 3 ] === 0 && // wrap around\n\t\t\tarr[ 4 ] === 1 // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasUint8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of 8-bit unsigned integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\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 using an octet array.\n*\n* @module @stdlib/buffer-from-array\n*\n* @example\n* import array2buffer from '@stdlib/buffer-from-array';\n*\n* var buf = array2buffer( [ 1, 2, 3, 4 ] );\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 array2buffer;\nif ( hasFrom ) {\n\tarray2buffer = main;\n} else {\n\tarray2buffer = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default array2buffer;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\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 from an `ArrayBuffer`.\n*\n* @module @stdlib/buffer-from-arraybuffer\n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n* import arraybuffer2buffer from '@stdlib/buffer-from-arraybuffer';\n*\n* var ab = new ArrayBuffer( 10 );\n* var buf = arraybuffer2buffer( ab );\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 arraybuffer2buffer;\nif ( hasFrom ) {\n\tarraybuffer2buffer = main;\n} else {\n\tarraybuffer2buffer = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default arraybuffer2buffer;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 '@stdlib/buffer-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 isCollection from '@stdlib/assert-is-collection';\nimport format from '@stdlib/string-format';\nimport Buffer from '@stdlib/buffer-ctor';\n\n\n// MAIN //\n\n/**\n* Allocates a buffer using an octet array.\n*\n* @param {Collection} arr - octet array\n* @throws {TypeError} must provide an array-like object\n* @returns {Buffer} new `Buffer` instance\n*\n* @example\n* import fromArray from '@stdlib/buffer-from-array';\n*\n* var buf = fromArray( [ 1, 2, 3, 4 ] );\n* // returns \n*/\nfunction fromArray( arr ) {\n\tif ( !isCollection( arr ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide an array-like object. Value: `%s`.', arr ) );\n\t}\n\treturn Buffer.from( arr );\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// MODULES //\n\nimport isCollection from '@stdlib/assert-is-collection';\nimport format from '@stdlib/string-format';\nimport Buffer from '@stdlib/buffer-ctor';\n\n\n// MAIN //\n\n/**\n* Allocates a buffer using an octet array.\n*\n* @param {Collection} arr - octet array\n* @throws {TypeError} must provide an array-like object\n* @returns {Buffer} new `Buffer` instance\n*\n* @example\n* import fromArray from '@stdlib/buffer-from-array';\n*\n* var buf = fromArray( [ 1, 2, 3, 4 ] );\n* // returns \n*/\nfunction fromArray( arr ) {\n\tif ( !isCollection( arr ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide an array-like object. Value: `%s`.', arr ) );\n\t}\n\treturn new Buffer( arr ); // eslint-disable-line no-buffer-constructor\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// MODULES //\n\nimport isArrayBuffer from '@stdlib/assert-is-arraybuffer';\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert-is-nonnegative-integer';\nimport Buffer from '@stdlib/buffer-ctor';\nimport format from '@stdlib/string-format';\nimport version from './node_version.js';\n\n\n// MAIN //\n\n/**\n* Allocates a buffer from an `ArrayBuffer`.\n*\n* ## Notes\n*\n* The behavior of this function varies across Node.js versions due to changes in the underlying Node.js APIs:\n*\n* - `<6.0.0`: if provided an empty ArrayBuffer, the function returns an empty Buffer which is **not** an ArrayBuffer view.\n* - otherwise, the function returns a view of an ArrayBuffer without copying the underlying memory.\n*\n* @param {ArrayBuffer} buf - ArrayBuffer instance\n* @param {NonNegativeInteger} [byteOffset=0] - index specifying the location of the first buffer byte\n* @param {NonNegativeInteger} [length=buf.byteLength] - number of buffer bytes\n* @throws {TypeError} first argument must be an ArrayBuffer\n* @throws {TypeError} second argument must be a nonnegative integer\n* @throws {RangeError} second argument must not exceed number of bytes in input ArrayBuffer\n* @throws {TypeError} last argument must be a nonnegative integer\n* @throws {RangeError} last argument must not exceed number of bytes in input ArrayBuffer\n* @returns {Buffer} new `Buffer` instance\n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n* var ab = new ArrayBuffer( 10 );\n*\n* var buf = fromArrayBuffer( ab );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n* var ab = new ArrayBuffer( 10 );\n*\n* var buf = fromArrayBuffer( ab, 2, 4 );\n* // returns \n*/\nfunction fromArrayBuffer( buf, byteOffset, length ) {\n\tvar offset;\n\tvar len;\n\tif ( !isArrayBuffer( buf ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an ArrayBuffer. Value: `%s`.', buf ) );\n\t}\n\tif ( arguments.length > 1 ) {\n\t\tif ( !isNonNegativeInteger( byteOffset ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', byteOffset ) );\n\t\t}\n\t\tif ( byteOffset > buf.byteLength ) {\n\t\t\tthrow new RangeError( format( 'invalid argument. Second argument must not exceed the number of bytes in the input ArrayBuffer. Value: `%s`.', byteOffset ) );\n\t\t}\n\t\toffset = byteOffset;\n\t\tif ( arguments.length > 2 ) {\n\t\t\tif ( !isNonNegativeInteger( length ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a nonnegative integer. Value: `%s`.', length ) );\n\t\t\t}\n\t\t\tif ( length > buf.byteLength ) {\n\t\t\t\tthrow new RangeError( format( 'invalid argument. Last argument must not exceed the number of bytes in the input ArrayBuffer. Value: `%s`.', length ) );\n\t\t\t}\n\t\t\tlen = length;\n\t\t} else {\n\t\t\tlen = buf.byteLength - offset;\n\t\t}\n\t} else {\n\t\toffset = 0;\n\t\tlen = buf.byteLength;\n\t}\n\t// Address Node v5.x where providing an empty ArrayBuffer throws an error:\n\tif ( len === 0 && version < 6 ) {\n\t\treturn Buffer.from( [] );\n\t}\n\treturn Buffer.from( buf, offset, len );\n}\n\n\n// EXPORTS //\n\nexport default fromArrayBuffer;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isArrayBuffer from '@stdlib/assert-is-arraybuffer';\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert-is-nonnegative-integer';\nimport Buffer from '@stdlib/buffer-ctor';\nimport Uint8Array from '@stdlib/array-uint8';\nimport fromArray from '@stdlib/buffer-from-array';\nimport format from '@stdlib/string-format';\nimport version from './node_version.js';\n\n\n// MAIN //\n\n/**\n* Allocates a buffer from an `ArrayBuffer`.\n*\n* ## Notes\n*\n* The behavior of this function varies across Node.js versions due to changes in the underlying Node.js APIs:\n*\n* - `<3.0.0`: the function copies ArrayBuffer bytes to a new Buffer instance.\n* - `>=3.0.0`: if provided a byte offset, the function copies `ArrayBuffer` bytes to a new `Buffer` instance; otherwise, the function returns a view of an `ArrayBuffer` without copying the underlying memory.\n* - `<6.0.0`: if provided an empty ArrayBuffer, the function returns an empty Buffer which is **not** an ArrayBuffer view.\n*\n* @param {ArrayBuffer} buf - ArrayBuffer instance\n* @param {NonNegativeInteger} [byteOffset=0] - index specifying the location of the first buffer byte\n* @param {NonNegativeInteger} [length=buf.byteLength] - number of buffer bytes\n* @throws {TypeError} first argument must be an ArrayBuffer\n* @throws {TypeError} second argument must be a nonnegative integer\n* @throws {RangeError} second argument must not exceed number of bytes in input ArrayBuffer\n* @throws {TypeError} last argument must be a nonnegative integer\n* @throws {RangeError} last argument must not exceed number of bytes in input ArrayBuffer\n* @returns {Buffer} new `Buffer` instance\n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n* var ab = new ArrayBuffer( 10 );\n*\n* var buf = fromArrayBuffer( ab );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n* var ab = new ArrayBuffer( 10 );\n*\n* var buf = fromArrayBuffer( ab, 2, 4 );\n* // returns \n*/\nfunction fromArrayBuffer( buf, byteOffset, length ) {\n\tvar len;\n\tif ( !isArrayBuffer( buf ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an ArrayBuffer. Value: `%s`.', buf ) );\n\t}\n\tif ( arguments.length > 1 ) {\n\t\tif ( !isNonNegativeInteger( byteOffset ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', byteOffset ) );\n\t\t}\n\t\tif ( byteOffset > buf.byteLength ) {\n\t\t\tthrow new RangeError( format( 'invalid argument. Second argument must not exceed the number of bytes in the input ArrayBuffer. Value: `%s`.', byteOffset ) );\n\t\t}\n\t\tif ( arguments.length > 2 ) {\n\t\t\tif ( !isNonNegativeInteger( length ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a nonnegative integer. Value: `%s`.', length ) );\n\t\t\t}\n\t\t\tif ( length > buf.byteLength ) {\n\t\t\t\tthrow new RangeError( format( 'invalid argument. Last argument must not exceed the number of bytes in the input ArrayBuffer. Value: `%s`.', length ) );\n\t\t\t}\n\t\t\tlen = length;\n\t\t} else {\n\t\t\tlen = buf.byteLength - byteOffset;\n\t\t}\n\t\treturn fromArray( new Uint8Array( buf, byteOffset, len ) );\n\t}\n\tif ( version < 3 ) {\n\t\treturn fromArray( new Uint8Array( buf ) );\n\t}\n\t// Address Node <= v5.x where providing an empty ArrayBuffer throws an error:\n\tif ( buf.byteLength === 0 ) {\n\t\treturn new Buffer( [] );\n\t}\n\treturn new Buffer( buf );\n}\n\n\n// EXPORTS //\n\nexport default fromArrayBuffer;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// MAIN //\n\nvar debug = logger( 'from-constant-stream' );\n\n\n// EXPORTS //\n\nexport default debug;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar Readable = require( 'readable-stream' ).Readable;\nimport isError from '@stdlib/assert-is-error';\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport isBuffer from '@stdlib/assert-is-buffer';\nimport isUint8Array from '@stdlib/assert-is-uint8array';\nimport arraybuffer2buffer from '@stdlib/buffer-from-arraybuffer';\nimport string2buffer from '@stdlib/buffer-from-string';\nimport Buffer from '@stdlib/buffer-ctor'; // TODO: replace Buffer.concat usage with stdlib pkg\nimport assign from '@stdlib/object-assign';\nimport format from '@stdlib/string-format';\nimport inherit from '@stdlib/utils-inherit';\nimport setNonEnumerable from '@stdlib/utils-define-nonenumerable-property';\nimport setNonEnumerableReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport nextTick from '@stdlib/utils-next-tick';\nimport DEFAULTS from './defaults.json';\nimport validate from './validate.js';\nimport debug from './debug.js';\n\n\n// FUNCTIONS //\n\n/**\n* Implements the `_read` method.\n*\n* @private\n* @param {number} size - number (of bytes) to read\n* @returns {void}\n*/\nfunction read() {\n\t/* eslint-disable no-invalid-this */\n\tvar FLG;\n\tif ( this._destroyed ) {\n\t\treturn;\n\t}\n\tFLG = true;\n\twhile ( FLG ) {\n\t\tthis._i += 1;\n\t\tif ( this._i > this._iter ) {\n\t\t\tdebug( 'Finished iteration.' );\n\t\t\treturn this.push( null );\n\t\t}\n\t\tdebug( 'Value: %s. Iter: %d.', this._value, this._i );\n\t\tif ( this._objectMode === false && this._i > 1 ) {\n\t\t\tFLG = this.push( Buffer.concat( [ this._sep, this._value ] ) );\n\t\t} else {\n\t\t\tFLG = this.push( this._value );\n\t\t}\n\t}\n\n\t/* eslint-enable no-invalid-this */\n}\n\n/**\n* Gracefully destroys a stream, providing backward compatibility.\n*\n* @private\n* @param {(string|Object|Error)} [error] - error\n* @returns {ConstantStream} Stream instance\n*/\nfunction destroy( error ) {\n\t/* eslint-disable no-invalid-this */\n\tvar self;\n\tif ( this._destroyed ) {\n\t\tdebug( 'Attempted to destroy an already destroyed stream.' );\n\t\treturn this;\n\t}\n\tself = this;\n\tthis._destroyed = true;\n\n\tnextTick( close );\n\n\treturn this;\n\n\t/**\n\t* Closes a stream.\n\t*\n\t* @private\n\t*/\n\tfunction close() {\n\t\tif ( error ) {\n\t\t\tdebug( 'Stream was destroyed due to an error. Error: %s.', ( isError( error ) ) ? error.message : JSON.stringify( error ) );\n\t\t\tself.emit( 'error', error );\n\t\t}\n\t\tdebug( 'Closing the stream...' );\n\t\tself.emit( 'close' );\n\t}\n\n\t/* eslint-enable no-invalid-this */\n}\n\n\n// MAIN //\n\n/**\n* Stream constructor for generating a stream which always streams the same value.\n*\n* @constructor\n* @param {(string|Buffer|Uint8Array)} value - value to stream\n* @param {Options} [options] - stream options\n* @param {boolean} [options.objectMode=false] - specifies whether the stream should operate in object mode\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to strings\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the maximum number of bytes to store in an internal buffer before pausing streaming\n* @param {string} [options.sep='\\n'] - separator used to join streamed data\n* @param {NonNegativeInteger} [options.iter] - number of iterations\n* @throws {TypeError} in binary mode, value to stream must be a string, `Buffer`, or `Uint8Array`\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {ConstantStream} Stream instance\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n*\n* function log( chunk ) {\n* console.log( chunk.toString() );\n* }\n*\n* var opts = {\n* 'iter': 10\n* };\n*\n* var stream = new ConstantStream( 'beep', opts );\n*\n* stream.pipe( inspectStream( log ) );\n*/\nfunction ConstantStream( value, options ) {\n\tvar opts;\n\tvar err;\n\tif ( !( this instanceof ConstantStream ) ) {\n\t\tif ( arguments.length > 1 ) {\n\t\t\treturn new ConstantStream( value, options );\n\t\t}\n\t\treturn new ConstantStream( value );\n\t}\n\topts = assign( {}, DEFAULTS );\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 ( opts.objectMode === false ) {\n\t\tif ( isString( value ) ) {\n\t\t\tvalue = string2buffer( value );\n\t\t} else if ( isBuffer( value ) ) { // NOTE: order matters here. We want the `isBuffer` check BEFORE the `isUint8Array` check!!\n\t\t\t// Nothing to do, as value is already a buffer...\n\t\t} else if ( isUint8Array( value ) ) {\n\t\t\t// Convert to a `Buffer` object to provide backward compatibility with older Node.js versions...\n\t\t\tvalue = arraybuffer2buffer( value.buffer, value.byteOffset, value.length ); // eslint-disable-line max-len\n\t\t} else {\n\t\t\tthrow new TypeError( format( 'invalid argument. In binary mode, a provided value must be a string, Buffer, or Uint8Array. Value: `%s`.', value ) );\n\t\t}\n\t}\n\t// Make the stream a readable stream:\n\tdebug( 'Creating a readable stream configured with the following options: %s.', JSON.stringify( opts ) );\n\tReadable.call( this, opts );\n\n\t// Destruction state:\n\tsetNonEnumerable( this, '_destroyed', false );\n\n\t// Cache whether the stream is operating in object mode:\n\tsetNonEnumerableReadOnly( this, '_objectMode', opts.objectMode );\n\n\t// Cache the separator:\n\tsetNonEnumerableReadOnly( this, '_sep', string2buffer( opts.sep ) );\n\n\t// Cache the total number of iterations:\n\tsetNonEnumerableReadOnly( this, '_iter', opts.iter );\n\n\t// Cache the value to stream:\n\tsetNonEnumerableReadOnly( this, '_value', value );\n\n\t// Initialize an iteration counter:\n\tsetNonEnumerable( this, '_i', 0 );\n\n\treturn this;\n}\n\n/*\n* Inherit from the `Readable` prototype.\n*/\ninherit( ConstantStream, Readable );\n\n/**\n* Implements the `_read` method.\n*\n* @private\n* @name _read\n* @memberof ConstantStream.prototype\n* @type {Function}\n* @param {number} size - number (of bytes) to read\n* @returns {void}\n*/\nsetNonEnumerableReadOnly( ConstantStream.prototype, '_read', read );\n\n/**\n* Gracefully destroys a stream, providing backward compatibility.\n*\n* @name destroy\n* @memberof ConstantStream.prototype\n* @type {Function}\n* @param {(string|Object|Error)} [error] - error\n* @returns {ConstantStream} Stream instance\n*/\nsetNonEnumerableReadOnly( ConstantStream.prototype, 'destroy', destroy );\n\n\n// EXPORTS //\n\nexport default ConstantStream;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isNonNegative } from '@stdlib/assert-is-nonnegative-number';\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert-is-nonnegative-integer';\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.sep] - separator used to join streamed data\n* @param {boolean} [options.objectMode] - specifies whether a stream should operate in object mode\n* @param {(string|null)} [options.encoding] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the maximum number of bytes to store in the internal buffer before pausing streaming\n* @param {NonNegativeInteger} [options.iter] - number of iterations\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'objectMode': true\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, 'sep' ) ) {\n\t\topts.sep = options.sep;\n\t\tif ( !isString( opts.sep ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'sep', opts.sep ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'objectMode' ) ) {\n\t\topts.objectMode = options.objectMode;\n\t\tif ( !isBoolean( opts.objectMode ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'objectMode', opts.objectMode ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'encoding' ) ) {\n\t\topts.encoding = options.encoding;\n\t\tif ( !isString( opts.encoding ) && opts.encoding !== null ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a string or null. Option: `%s`.', 'encoding', opts.encoding ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'highWaterMark' ) ) {\n\t\topts.highWaterMark = options.highWaterMark;\n\t\tif ( !isNonNegative( opts.highWaterMark ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a nonnegative number. Option: `%s`.', 'highWaterMark', opts.highWaterMark ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'iter' ) ) {\n\t\topts.iter = options.iter;\n\t\tif ( !isNonNegativeInteger( opts.iter ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a nonnegative integer. Option: `%s`.', 'iter', opts.iter ) );\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/**\n* Create a readable stream which always streams the same value.\n*\n* @module @stdlib/streams-node-from-constant\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n* import constantStream from '@stdlib/streams-node-from-constant';\n*\n* function log( chunk ) {\n* console.log( chunk.toString() );\n* }\n*\n* var opts = {\n* 'iter': 10\n* };\n*\n* var stream = constantStream( 'beep', opts );\n*\n* stream.pipe( inspectStream( log ) );\n*\n* @example\n* import constantStream from '@stdlib/streams-node-from-constant';\n*\n* var opts = {\n* 'sep': ',',\n* 'objectMode': false,\n* 'encoding': 'utf8',\n* 'highWaterMark': 64\n* };\n*\n* var createStream = constantStream.factory( opts );\n*\n* // Create 10 identically configured streams...\n* var streams = [];\n* var i;\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( createStream( i.toString() ) );\n* }\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n* import constantStream from '@stdlib/streams-node-from-constant';\n*\n* function log( v ) {\n* console.log( v );\n* }\n*\n* var opts = {\n* 'iter': 10\n* };\n*\n* var stream = constantStream.objectMode( 3.14, opts );\n*\n* stream.pipe( inspectStream.objectMode( log ) );\n*/\n\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport objectMode from './object_mode.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'objectMode', objectMode );\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 isObject from '@stdlib/assert-is-plain-object';\nimport format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport ConstantStream from './main.js';\n\n\n// MAIN //\n\n/**\n* Returns an \"objectMode\" readable stream which always streams the same value.\n*\n* @param {*} value - value to stream\n* @param {Options} [options] - stream options\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the maximum number of objects to store in an internal buffer before pausing streaming\n* @param {NonNegativeInteger} [options.iter] - number of iterations\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {ConstantStream} Stream instance\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n*\n* function log( v ) {\n* console.log( v );\n* }\n*\n* var opts = {\n* 'iter': 10\n* };\n*\n* var stream = objectMode( 3.14, opts );\n*\n* stream.pipe( inspectStream.objectMode( log ) );\n*/\nfunction objectMode( value, options ) {\n\tvar opts;\n\tif ( arguments.length > 1 ) {\n\t\topts = options;\n\t\tif ( !isObject( opts ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', opts ) );\n\t\t}\n\t\topts = assign( {}, options );\n\t} else {\n\t\topts = {};\n\t}\n\topts.objectMode = true;\n\treturn new ConstantStream( value, opts );\n}\n\n\n// EXPORTS //\n\nexport default objectMode;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isObject from '@stdlib/assert-is-plain-object';\nimport format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport ConstantStream from './main.js';\n\n\n// MAIN //\n\n/**\n* Returns a function for creating readable streams which always stream the same value.\n*\n* @param {(string|Buffer|Uint8Array|*)} [value] - value to stream\n* @param {Options} [options] - stream options\n* @param {boolean} [options.objectMode=false] - specifies whether a stream should operate in object mode\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the maximum number of bytes to store in an internal buffer before pausing streaming\n* @param {string} [options.sep='\\n'] - separator used to join streamed data\n* @param {NonNegativeInteger} [options.iter] - number of iterations\n* @throws {TypeError} options argument must be an object\n* @returns {Function} stream factory\n*\n* @example\n* var opts = {\n* 'sep': ',',\n* 'objectMode': false,\n* 'encoding': 'utf8',\n* 'highWaterMark': 64\n* };\n*\n* var createStream = factory( opts );\n*\n* // Create 10 identically configured streams...\n* var streams = [];\n* var i;\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( createStream( i.toString() ) );\n* }\n*/\nfunction factory( value, options ) {\n\tvar nargs;\n\tvar opts;\n\tvar fcn;\n\tvar FLG;\n\n\tnargs = arguments.length;\n\tif ( nargs === 0 ) {\n\t\topts = {};\n\t\tFLG = true;\n\t} else if ( nargs === 1 ) {\n\t\t// Check (imperfectly!) whether we were provided an \"options\" object...\n\t\tif (\n\t\t\tvalue !== null &&\n\t\t\ttypeof value === 'object' &&\n\t\t\t(\n\t\t\t\thasOwnProp( value, 'sep' ) ||\n\t\t\t\thasOwnProp( value, 'iter' ) ||\n\t\t\t\thasOwnProp( value, 'objectMode' ) ||\n\t\t\t\thasOwnProp( value, 'encoding' ) ||\n\t\t\t\thasOwnProp( value, 'highWaterMark' )\n\t\t\t)\n\t\t) {\n\t\t\topts = assign( {}, value );\n\t\t\tFLG = true;\n\t\t} else {\n\t\t\topts = {};\n\t\t}\n\t} else { // nargs > 1\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\topts = assign( {}, options );\n\t}\n\tif ( FLG ) {\n\t\tfcn = createStream1;\n\t} else {\n\t\tfcn = createStream2;\n\t}\n\treturn fcn;\n\n\t/**\n\t* Returns a readable stream which always streams the same value.\n\t*\n\t* @private\n\t* @param {(string|Buffer|Uint8Array|*)} value - value to stream\n\t* @throws {TypeError} in binary mode, value to stream must be a string, Buffer, or Uint8Array\n\t* @throws {TypeError} options argument must be an object\n\t* @throws {TypeError} must provide valid options\n\t* @returns {ConstantStream} Stream instance\n\t*/\n\tfunction createStream1( value ) {\n\t\treturn new ConstantStream( value, opts );\n\t}\n\n\t/**\n\t* Returns a readable stream which always streams the same value.\n\t*\n\t* @private\n\t* @throws {TypeError} in binary mode, value to stream must be a string, Buffer, or Uint8Array\n\t* @throws {TypeError} options argument must be an object\n\t* @throws {TypeError} must provide valid options\n\t* @returns {ConstantStream} Stream instance\n\t*/\n\tfunction createStream2() {\n\t\treturn new ConstantStream( value, opts );\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\nvar logger = require( 'debug' );\n\n\n// MAIN //\n\nvar debug = logger( 'from-iterator-stream' );\n\n\n// EXPORTS //\n\nexport default debug;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar Readable = require( 'readable-stream' ).Readable;\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport isIteratorLike from '@stdlib/assert-is-iterator-like';\nimport isError from '@stdlib/assert-is-error';\nimport isBuffer from '@stdlib/assert-is-buffer';\nimport assign from '@stdlib/object-assign';\nimport inherit from '@stdlib/utils-inherit';\nimport setNonEnumerable from '@stdlib/utils-define-nonenumerable-property';\nimport setNonEnumerableReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport string2buffer from '@stdlib/buffer-from-string';\nimport Buffer from '@stdlib/buffer-ctor'; // TODO: replace Buffer.concat usage with stdlib pkg\nimport nextTick from '@stdlib/utils-next-tick';\nimport format from '@stdlib/string-format';\nimport DEFAULTS from './defaults.json';\nimport validate from './validate.js';\nimport debug from './debug.js';\n\n\n// FUNCTIONS //\n\n/**\n* Implements the `_read` method.\n*\n* @private\n* @param {number} size - number (of bytes) to read\n* @returns {void}\n*/\nfunction read() {\n\t/* eslint-disable no-invalid-this */\n\tvar FLG;\n\tvar err;\n\tvar v;\n\n\tif ( this._destroyed ) {\n\t\treturn;\n\t}\n\tFLG = true;\n\twhile ( FLG ) {\n\t\tv = this._iterator.next();\n\t\tthis._i += 1;\n\t\tif ( v.done ) {\n\t\t\tif ( hasOwnProp( v, 'value' ) ) {\n\t\t\t\tv = v.value;\n\t\t\t\tdebug( 'Value: %s. Iter: %d.', JSON.stringify( v ), this._i );\n\t\t\t\tif ( this._objectMode === false ) {\n\t\t\t\t\tv = this._serialize( v );\n\t\t\t\t\tif ( typeof v === 'string' ) {\n\t\t\t\t\t\tif ( this._i === 1 ) { // eslint-disable-line max-depth\n\t\t\t\t\t\t\tv = string2buffer( v );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tv = string2buffer( this._sep+v );\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis.push( v );\n\t\t\t\t\t} else if ( isBuffer( v ) ) {\n\t\t\t\t\t\tif ( this._i > 1 ) { // eslint-disable-line max-depth\n\t\t\t\t\t\t\tv = Buffer.concat( [ string2buffer( this._sep ), v ] ); // eslint-disable-line max-len\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis.push( v );\n\t\t\t\t\t} else {\n\t\t\t\t\t\terr = new Error( format( 'invalid operation. Serialization function must return a string or Buffer. Value: `%s`.', v ) );\n\t\t\t\t\t\tthis.emit( 'error', err );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tdebug( 'Finished iteration.' );\n\t\t\treturn this.push( null );\n\t\t}\n\t\tv = v.value;\n\t\tdebug( 'Value: %s. Iter: %d.', JSON.stringify( v ), this._i );\n\n\t\tif ( this._objectMode === false ) {\n\t\t\tv = this._serialize( v );\n\t\t\tif ( typeof v === 'string' ) {\n\t\t\t\tif ( this._i === 1 ) {\n\t\t\t\t\tv = string2buffer( v );\n\t\t\t\t} else {\n\t\t\t\t\tv = string2buffer( this._sep+v );\n\t\t\t\t}\n\t\t\t} else if ( isBuffer( v ) ) {\n\t\t\t\tif ( this._i > 1 ) {\n\t\t\t\t\tv = Buffer.concat( [ string2buffer( this._sep ), v ] );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\terr = new Error( format( 'invalid operation. Serialization function must return a string or Buffer. Value: `%s`.', v ) );\n\t\t\t\tthis.emit( 'error', err );\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\tFLG = this.push( v );\n\t}\n\n\t/* eslint-enable no-invalid-this */\n}\n\n/**\n* Gracefully destroys a stream, providing backward compatibility.\n*\n* @private\n* @param {(string|Object|Error)} [error] - error\n* @returns {IteratorStream} Stream instance\n*/\nfunction destroy( error ) {\n\t/* eslint-disable no-invalid-this */\n\tvar self;\n\tif ( this._destroyed ) {\n\t\tdebug( 'Attempted to destroy an already destroyed stream.' );\n\t\treturn this;\n\t}\n\tself = this;\n\tthis._destroyed = true;\n\n\tnextTick( close );\n\n\treturn this;\n\n\t/**\n\t* Closes a stream.\n\t*\n\t* @private\n\t*/\n\tfunction close() {\n\t\tif ( error ) {\n\t\t\tdebug( 'Stream was destroyed due to an error. Error: %s.', ( isError( error ) ) ? error.message : JSON.stringify( error ) );\n\t\t\tself.emit( 'error', error );\n\t\t}\n\t\tdebug( 'Closing the stream...' );\n\t\tself.emit( 'close' );\n\t}\n\n\t/* eslint-enable no-invalid-this */\n}\n\n\n// MAIN //\n\n/**\n* Stream constructor for generating a readable stream from an iterator.\n*\n* @constructor\n* @param {Iterator} iterator - source iterator\n* @param {Options} [options] - stream options\n* @param {boolean} [options.objectMode=false] - specifies whether the stream should operate in object mode\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to strings\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the maximum number of bytes to store in an internal buffer before pausing iteration\n* @param {string} [options.sep='\\n'] - separator used to join streamed data\n* @param {Function} [options.serialize] - custom serialization function\n* @throws {TypeError} first argument must be an iterator\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {IteratorStream} Stream instance\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n* import randu from '@stdlib/random-iter-randu';\n*\n* function log( chunk ) {\n* console.log( chunk.toString() );\n* }\n*\n* var opts = {\n* 'iter': 10\n* };\n*\n* var stream = new IteratorStream( randu( opts ) );\n*\n* stream.pipe( inspectStream( log ) );\n*/\nfunction IteratorStream( iterator, options ) {\n\tvar opts;\n\tvar err;\n\tif ( !( this instanceof IteratorStream ) ) {\n\t\tif ( arguments.length > 1 ) {\n\t\t\treturn new IteratorStream( iterator, options );\n\t\t}\n\t\treturn new IteratorStream( iterator );\n\t}\n\tif ( !isIteratorLike( iterator ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an iterator. Value: `%s`.', iterator ) );\n\t}\n\topts = assign( {}, DEFAULTS );\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\t// Make the stream a readable stream:\n\tdebug( 'Creating a readable stream configured with the following options: %s.', JSON.stringify( opts ) );\n\tReadable.call( this, opts );\n\n\t// Destruction state:\n\tsetNonEnumerable( this, '_destroyed', false );\n\n\t// Cache whether the stream is operating in object mode:\n\tsetNonEnumerableReadOnly( this, '_objectMode', opts.objectMode );\n\n\t// Cache the separator:\n\tsetNonEnumerableReadOnly( this, '_sep', opts.sep );\n\n\t// Define the serialization function:\n\tsetNonEnumerableReadOnly( this, '_serialize', opts.serialize || JSON.stringify );\n\n\t// Cache the iterator:\n\tsetNonEnumerableReadOnly( this, '_iterator', iterator );\n\n\t// Initialize an iteration counter:\n\tsetNonEnumerable( this, '_i', 0 );\n\n\treturn this;\n}\n\n/*\n* Inherit from the `Readable` prototype.\n*/\ninherit( IteratorStream, Readable );\n\n/**\n* Implements the `_read` method.\n*\n* @private\n* @name _read\n* @memberof IteratorStream.prototype\n* @type {Function}\n* @param {number} size - number (of bytes) to read\n* @returns {void}\n*/\nsetNonEnumerableReadOnly( IteratorStream.prototype, '_read', read );\n\n/**\n* Gracefully destroys a stream, providing backward compatibility.\n*\n* @name destroy\n* @memberof IteratorStream.prototype\n* @type {Function}\n* @param {(string|Object|Error)} [error] - error\n* @returns {IteratorStream} Stream instance\n*/\nsetNonEnumerableReadOnly( IteratorStream.prototype, 'destroy', destroy );\n\n\n// EXPORTS //\n\nexport default IteratorStream;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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';\n\n\n// MAIN //\n\n/**\n* Tests if a value is iterator-like.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is iterator-like\n*\n* @example\n* var it = {\n* 'next': function noop() {}\n* };\n* var bool = isIteratorLike( it );\n* // returns true\n*\n* @example\n* var bool = isIteratorLike( {} );\n* // returns false\n*\n* @example\n* var bool = isIteratorLike( null );\n* // returns false\n*/\nfunction isIteratorLike( value ) {\n\tvar t = typeof value;\n\treturn (\n\t\tvalue !== null &&\n\t\t( t === 'object' || t === 'function' ) &&\n\t\tisFunction( value.next )\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isIteratorLike;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isNonNegative } from '@stdlib/assert-is-nonnegative-number';\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport isFunction from '@stdlib/assert-is-function';\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.sep] - separator used to join streamed data\n* @param {boolean} [options.objectMode] - specifies whether a stream should operate in object mode\n* @param {(string|null)} [options.encoding] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the maximum number of bytes to store in the internal buffer before pausing iteration\n* @param {Function} [options.serialize] - custom serialization function\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'objectMode': true\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, 'sep' ) ) {\n\t\topts.sep = options.sep;\n\t\tif ( !isString( opts.sep ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'sep', opts.sep ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'objectMode' ) ) {\n\t\topts.objectMode = options.objectMode;\n\t\tif ( !isBoolean( opts.objectMode ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'objectMode', opts.objectMode ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'encoding' ) ) {\n\t\topts.encoding = options.encoding;\n\t\tif ( !isString( opts.encoding ) && opts.encoding !== null ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a string or null. Option: `%s`.', 'encoding', opts.encoding ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'highWaterMark' ) ) {\n\t\topts.highWaterMark = options.highWaterMark;\n\t\tif ( !isNonNegative( opts.highWaterMark ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a nonnegative number. Option: `%s`.', 'highWaterMark', opts.highWaterMark ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'serialize' ) ) {\n\t\topts.serialize = options.serialize;\n\t\tif ( !isFunction( opts.serialize ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a function. Option: `%s`.', 'serialize', opts.serialize ) );\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/**\n* Create a readable stream from an iterator.\n*\n* @module @stdlib/streams-node-from-iterator\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n* import randu from '@stdlib/random-iter-randu';\n* import iteratorStream from '@stdlib/streams-node-from-iterator';\n*\n* function log( chunk ) {\n* console.log( chunk.toString() );\n* }\n*\n* var opts = {\n* 'iter': 10\n* };\n*\n* var stream = iteratorStream( randu( opts ) );\n*\n* stream.pipe( inspectStream( log ) );\n*\n* @example\n* import randu from '@stdlib/random-iter-randu';\n* import iteratorStream from '@stdlib/streams-node-from-iterator';\n*\n* var opts = {\n* 'sep': ',',\n* 'objectMode': false,\n* 'encoding': 'utf8',\n* 'highWaterMark': 64\n* };\n*\n* var createStream = iteratorStream.factory( opts );\n*\n* // Create 10 identically configured streams...\n* var streams = [];\n* var i;\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( createStream( randu() ) );\n* }\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n* import randu from '@stdlib/random-iter-randu';\n* import iteratorStream from '@stdlib/streams-node-from-iterator';\n*\n* function log( v ) {\n* console.log( v );\n* }\n*\n* var opts = {\n* 'iter': 10\n* };\n*\n* var stream = iteratorStream.objectMode( randu( opts ) );\n*\n* stream.pipe( inspectStream.objectMode( log ) );\n*/\n\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport objectMode from './object_mode.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'objectMode', objectMode );\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 isObject from '@stdlib/assert-is-plain-object';\nimport format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport IteratorStream from './main.js';\n\n\n// MAIN //\n\n/**\n* Returns an \"objectMode\" readable stream from an iterator.\n*\n* @param {Iterator} iterator - source iterator\n* @param {Options} [options] - stream options\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the maximum number of objects to store in an internal buffer before pausing iteration\n* @throws {TypeError} first argument must be an iterator\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {IteratorStream} Stream instance\n*\n* @example\n* import randu from '@stdlib/random-iter-randu';\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n*\n* function log( v ) {\n* console.log( v );\n* }\n*\n* var opts = {\n* 'iter': 10\n* };\n*\n* var stream = objectMode( randu( opts ) );\n*\n* stream.pipe( inspectStream.objectMode( log ) );\n*/\nfunction objectMode( iterator, options ) {\n\tvar opts;\n\tif ( arguments.length > 1 ) {\n\t\topts = options;\n\t\tif ( !isObject( opts ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', opts ) );\n\t\t}\n\t\topts = assign( {}, options );\n\t} else {\n\t\topts = {};\n\t}\n\topts.objectMode = true;\n\treturn new IteratorStream( iterator, opts );\n}\n\n\n// EXPORTS //\n\nexport default objectMode;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport IteratorStream from './main.js';\n\n\n// MAIN //\n\n/**\n* Returns a function for creating readable streams from iterators.\n*\n* @param {Options} [options] - stream options\n* @param {boolean} [options.objectMode=false] - specifies whether a stream should operate in object mode\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the maximum number of bytes to store in an internal buffer before pausing iteration\n* @param {string} [options.sep='\\n'] - separator used to join streamed data\n* @param {Function} [options.serialize] - custom serialization function\n* @throws {TypeError} options argument must be an object\n* @returns {Function} stream factory\n*\n* @example\n* import randu from '@stdlib/random-iter-randu';\n*\n* var opts = {\n* 'sep': ',',\n* 'objectMode': false,\n* 'encoding': 'utf8',\n* 'highWaterMark': 64\n* };\n*\n* var createStream = factory( opts );\n*\n* // Create 10 identically configured streams...\n* var streams = [];\n* var i;\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( createStream( randu() ) );\n* }\n*/\nfunction factory( options ) {\n\tvar opts;\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\topts = assign( {}, options );\n\t} else {\n\t\topts = {};\n\t}\n\treturn createStream;\n\n\t/**\n\t* Returns a readable stream from an iterator.\n\t*\n\t* @private\n\t* @param {Iterator} iterator - source iterator\n\t* @throws {TypeError} must provide an iterator\n\t* @throws {TypeError} options argument must be an object\n\t* @throws {TypeError} must provide valid options\n\t* @returns {IteratorStream} Stream instance\n\t*/\n\tfunction createStream( iterator ) {\n\t\treturn new IteratorStream( iterator, opts );\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\nvar logger = require( 'debug' );\n\n\n// MAIN //\n\nvar debug = logger( 'from-strided-array-stream' );\n\n\n// EXPORTS //\n\nexport default debug;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar Readable = require( 'readable-stream' ).Readable;\nimport isCollection from '@stdlib/assert-is-collection';\nimport isError from '@stdlib/assert-is-error';\nimport isBuffer from '@stdlib/assert-is-buffer';\nimport { isPrimitive as isInteger } from '@stdlib/assert-is-integer';\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert-is-nonnegative-integer';\nimport assign from '@stdlib/object-assign';\nimport inherit from '@stdlib/utils-inherit';\nimport setNonEnumerable from '@stdlib/utils-define-nonenumerable-property';\nimport setNonEnumerableReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport string2buffer from '@stdlib/buffer-from-string';\nimport Buffer from '@stdlib/buffer-ctor'; // TODO: replace Buffer.concat usage with stdlib pkg\nimport format from '@stdlib/string-format';\nimport nextTick from '@stdlib/utils-next-tick';\nimport DEFAULTS from './defaults.json';\nimport validate from './validate.js';\nimport debug from './debug.js';\n\n\n// FUNCTIONS //\n\n/**\n* Implements the `_read` method.\n*\n* @private\n* @param {number} size - number (of bytes) to read\n* @returns {void}\n*/\nfunction read() {\n\t/* eslint-disable no-invalid-this */\n\tvar FLG;\n\tvar err;\n\tvar v;\n\n\tif ( this._destroyed ) {\n\t\treturn;\n\t}\n\tFLG = true;\n\twhile ( FLG ) {\n\t\terr = null;\n\n\t\tthis._i += 1;\n\t\tif ( this._i > this._N ) {\n\t\t\tdebug( 'Finished iteration.' );\n\t\t\treturn this.push( null );\n\t\t}\n\t\tv = this._buffer[ this._idx ];\n\t\tdebug( 'Value: %s. Idx: %d. Iter: %d.', JSON.stringify( v ), this._idx, this._i );\n\n\t\tthis._idx += this._stride;\n\t\tif ( this._objectMode === false ) {\n\t\t\tv = this._serialize( v );\n\t\t\tif ( typeof v === 'string' ) {\n\t\t\t\tif ( this._i === 1 ) {\n\t\t\t\t\tv = string2buffer( v );\n\t\t\t\t} else {\n\t\t\t\t\tv = string2buffer( this._sep+v );\n\t\t\t\t}\n\t\t\t} else if ( isBuffer( v ) ) {\n\t\t\t\tif ( this._i > 1 ) {\n\t\t\t\t\tv = Buffer.concat( [ string2buffer( this._sep ), v ] );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\terr = new Error( format( 'invalid operation. Serialization function must return a string or Buffer. Value: `%s`.', v ) );\n\t\t\t}\n\t\t}\n\t\tif ( err ) {\n\t\t\tthis.emit( 'error', err );\n\t\t} else {\n\t\t\tFLG = this.push( v );\n\t\t}\n\t}\n\n\t/* eslint-enable no-invalid-this */\n}\n\n/**\n* Gracefully destroys a stream, providing backward compatibility.\n*\n* @private\n* @param {(string|Object|Error)} [error] - error\n* @returns {StridedArrayStream} Stream instance\n*/\nfunction destroy( error ) {\n\t/* eslint-disable no-invalid-this */\n\tvar self;\n\tif ( this._destroyed ) {\n\t\tdebug( 'Attempted to destroy an already destroyed stream.' );\n\t\treturn this;\n\t}\n\tself = this;\n\tthis._destroyed = true;\n\n\tnextTick( close );\n\n\treturn this;\n\n\t/**\n\t* Closes a stream.\n\t*\n\t* @private\n\t*/\n\tfunction close() {\n\t\tif ( error ) {\n\t\t\tdebug( 'Stream was destroyed due to an error. Error: %s.', ( isError( error ) ) ? error.message : JSON.stringify( error ) );\n\t\t\tself.emit( 'error', error );\n\t\t}\n\t\tdebug( 'Closing the stream...' );\n\t\tself.emit( 'close' );\n\t}\n\n\t/* eslint-enable no-invalid-this */\n}\n\n\n// MAIN //\n\n/**\n* Stream constructor for generating a readable stream from an array-like object.\n*\n* @constructor\n* @param {NonNegativeInteger} N - number of values to stream\n* @param {Collection} buffer - source value\n* @param {integer} stride - stride length\n* @param {NonNegativeInteger} offset - starting index\n* @param {Options} [options] - stream options\n* @param {boolean} [options.objectMode=false] - specifies whether the stream should operate in object mode\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to strings\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the maximum number of bytes to store in an internal buffer before pausing streaming\n* @param {string} [options.sep='\\n'] - separator used to join streamed data\n* @param {Function} [options.serialize] - custom serialization function\n* @throws {TypeError} first argument must be a nonnegative integer\n* @throws {TypeError} second argument must be an array-like object\n* @throws {TypeError} third argument must be an integer\n* @throws {TypeError} fourth argument must be a nonnegative integer\n* @throws {RangeError} linear index cannot exceed array bounds\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {StridedArrayStream} Stream instance\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n* import Float64Array from '@stdlib/array-float64';\n* import randu from '@stdlib/random-base-randu';\n*\n* function log( chunk ) {\n* console.log( chunk.toString() );\n* }\n*\n* var arr = new Float64Array( 10 );\n* var i;\n* for ( i = 0; i < arr.length; i++ ) {\n* arr[ i ] = randu();\n* }\n*\n* var stream = new StridedArrayStream( arr.length, arr, 1, 0 );\n*\n* stream.pipe( inspectStream( log ) );\n*/\nfunction StridedArrayStream( N, buffer, stride, offset, options ) {\n\tvar opts;\n\tvar err;\n\tvar i;\n\tif ( !( this instanceof StridedArrayStream ) ) {\n\t\tif ( arguments.length > 4 ) {\n\t\t\treturn new StridedArrayStream( N, buffer, stride, offset, options );\n\t\t}\n\t\treturn new StridedArrayStream( N, buffer, stride, offset );\n\t}\n\tif ( !isNonNegativeInteger( N ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a nonnegative integer. Value: `%s`.', N ) );\n\t}\n\tif ( !isCollection( buffer ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be an array-like object. Value: `%s`.', buffer ) );\n\t}\n\tif ( !isInteger( stride ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Third argument must be an integer. Value: `%s`.', stride ) );\n\t}\n\tif ( !isNonNegativeInteger( offset ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Fourth argument must be a nonnegative integer. Value: `%s`.', offset ) );\n\t}\n\tif ( N > 0 ) {\n\t\ti = offset + ((N-1)*stride);\n\t\tif ( offset >= buffer.length || i < 0 || i >= buffer.length ) {\n\t\t\tthrow new RangeError( 'invalid arguments. Strided array parameters are incompatible with the provided array-like object. Linear index exceeds array bounds.' );\n\t\t}\n\t}\n\topts = assign( {}, DEFAULTS );\n\tif ( arguments.length > 4 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t}\n\t// Make the stream a readable stream:\n\tdebug( 'Creating a readable stream configured with the following options: %s.', JSON.stringify( opts ) );\n\tReadable.call( this, opts );\n\n\t// Destruction state:\n\tsetNonEnumerable( this, '_destroyed', false );\n\n\t// Cache whether the stream is operating in object mode:\n\tsetNonEnumerableReadOnly( this, '_objectMode', opts.objectMode );\n\n\t// Cache the separator:\n\tsetNonEnumerableReadOnly( this, '_sep', opts.sep );\n\n\t// Define the serialization function:\n\tsetNonEnumerableReadOnly( this, '_serialize', opts.serialize || JSON.stringify );\n\n\t// Cache the data source:\n\tsetNonEnumerableReadOnly( this, '_buffer', buffer );\n\n\t// Cache the strided array parameters:\n\tsetNonEnumerableReadOnly( this, '_N', N );\n\tsetNonEnumerableReadOnly( this, '_stride', stride );\n\tsetNonEnumerableReadOnly( this, '_offset', offset );\n\tsetNonEnumerable( this, '_idx', offset );\n\n\t// Initialize an iteration counter:\n\tsetNonEnumerable( this, '_i', 0 );\n\n\treturn this;\n}\n\n/*\n* Inherit from the `Readable` prototype.\n*/\ninherit( StridedArrayStream, Readable );\n\n/**\n* Implements the `_read` method.\n*\n* @private\n* @name _read\n* @memberof StridedArrayStream.prototype\n* @type {Function}\n* @param {number} size - number (of bytes) to read\n* @returns {void}\n*/\nsetNonEnumerableReadOnly( StridedArrayStream.prototype, '_read', read );\n\n/**\n* Gracefully destroys a stream, providing backward compatibility.\n*\n* @name destroy\n* @memberof StridedArrayStream.prototype\n* @type {Function}\n* @param {(string|Object|Error)} [error] - error\n* @returns {StridedArrayStream} Stream instance\n*/\nsetNonEnumerableReadOnly( StridedArrayStream.prototype, 'destroy', destroy );\n\n\n// EXPORTS //\n\nexport default StridedArrayStream;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isNonNegative } from '@stdlib/assert-is-nonnegative-number';\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport isFunction from '@stdlib/assert-is-function';\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.sep] - separator used to join streamed data\n* @param {boolean} [options.objectMode] - specifies whether a stream should operate in object mode\n* @param {(string|null)} [options.encoding] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the maximum number of bytes to store in the internal buffer before pausing streaming\n* @param {Function} [options.serialize] - custom serialization function\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'objectMode': true\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, 'sep' ) ) {\n\t\topts.sep = options.sep;\n\t\tif ( !isString( opts.sep ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'sep', opts.sep ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'objectMode' ) ) {\n\t\topts.objectMode = options.objectMode;\n\t\tif ( !isBoolean( opts.objectMode ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'objectMode', opts.objectMode ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'encoding' ) ) {\n\t\topts.encoding = options.encoding;\n\t\tif ( !isString( opts.encoding ) && opts.encoding !== null ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a string or null. Option: `%s`.', 'encoding', opts.encoding ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'highWaterMark' ) ) {\n\t\topts.highWaterMark = options.highWaterMark;\n\t\tif ( !isNonNegative( opts.highWaterMark ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a nonnegative number. Option: `%s`.', 'highWaterMark', opts.highWaterMark ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'serialize' ) ) {\n\t\topts.serialize = options.serialize;\n\t\tif ( !isFunction( opts.serialize ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a function. Option: `%s`.', 'serialize', opts.serialize ) );\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/**\n* Create a readable stream from a strided array-like value.\n*\n* @module @stdlib/streams-node-from-strided-array\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n* import Float64Array from '@stdlib/array-float64';\n* import randu from '@stdlib/random-base-randu';\n* import stridedArrayStream from '@stdlib/streams-node-from-strided-array';\n*\n* function log( chunk ) {\n* console.log( chunk.toString() );\n* }\n*\n* var arr = new Float64Array( 10 );\n* var i;\n* for ( i = 0; i < arr.length; i++ ) {\n* arr[ i ] = randu();\n* }\n*\n* var stream = stridedArrayStream( arr.length, arr, 1, 0 );\n*\n* stream.pipe( inspectStream( log ) );\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n* import randu from '@stdlib/random-base-randu';\n* import stridedArrayStream from '@stdlib/streams-node-from-strided-array';\n*\n* var arr = new Float64Array( 10 );\n* var i;\n* for ( i = 0; i < arr.length; i++ ) {\n* arr[ i ] = randu();\n* }\n*\n* var opts = {\n* 'sep': ',',\n* 'objectMode': false,\n* 'encoding': 'utf8',\n* 'highWaterMark': 64\n* };\n*\n* var createStream = stridedArrayStream.factory( opts );\n*\n* // Create 10 identically configured streams...\n* var streams = [];\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( createStream( arr.length, arr, 1, 0 ) );\n* }\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n* import Float64Array from '@stdlib/array-float64';\n* import randu from '@stdlib/random-base-randu';\n* import stridedArrayStream from '@stdlib/streams-node-from-strided-array';\n*\n* function log( v ) {\n* console.log( v );\n* }\n*\n* var arr = new Float64Array( 10 );\n* var i;\n* for ( i = 0; i < arr.length; i++ ) {\n* arr[ i ] = randu();\n* }\n*\n* var stream = stridedArrayStream.objectMode( arr.length, arr, 1, 0 );\n*\n* stream.pipe( inspectStream.objectMode( log ) );\n*/\n\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport objectMode from './object_mode.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'objectMode', objectMode );\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 isObject from '@stdlib/assert-is-plain-object';\nimport format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport StridedArrayStream from './main.js';\n\n\n// MAIN //\n\n/**\n* Returns an \"objectMode\" readable stream from an array-like value.\n*\n* @param {NonNegativeInteger} N - number of values to stream\n* @param {Collection} buffer - source value\n* @param {integer} stride - stride length\n* @param {NonNegativeInteger} offset - starting index\n* @param {Options} [options] - stream options\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the maximum number of objects to store in an internal buffer before pausing streaming\n* @throws {TypeError} first argument must be a nonnegative integer\n* @throws {TypeError} second argument must be an array-like object\n* @throws {TypeError} third argument must be an integer\n* @throws {TypeError} fourth argument must be a nonnegative integer\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {StridedArrayStream} Stream instance\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n* import Float64Array from '@stdlib/array-float64';\n* import randu from '@stdlib/random-base-randu';\n*\n* function log( v ) {\n* console.log( v );\n* }\n*\n* var arr = new Float64Array( 10 );\n* var i;\n* for ( i = 0; i < arr.length; i++ ) {\n* arr[ i ] = randu();\n* }\n*\n* var stream = objectMode( arr.length, arr, 1, 0 );\n*\n* stream.pipe( inspectStream.objectMode( log ) );\n*/\nfunction objectMode( N, buffer, stride, offset, options ) {\n\tvar opts;\n\tif ( arguments.length > 4 ) {\n\t\topts = options;\n\t\tif ( !isObject( opts ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', opts ) );\n\t\t}\n\t\topts = assign( {}, options );\n\t} else {\n\t\topts = {};\n\t}\n\topts.objectMode = true;\n\treturn new StridedArrayStream( N, buffer, stride, offset, opts );\n}\n\n\n// EXPORTS //\n\nexport default objectMode;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport StridedArrayStream from './main.js';\n\n\n// MAIN //\n\n/**\n* Returns a function for creating readable streams from strided array-like values.\n*\n* @param {Options} [options] - stream options\n* @param {boolean} [options.objectMode=false] - specifies whether a stream should operate in object mode\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the maximum number of bytes to store in an internal buffer before pausing streaming\n* @param {string} [options.sep='\\n'] - separator used to join streamed data\n* @param {Function} [options.serialize] - custom serialization function\n* @throws {TypeError} options argument must be an object\n* @returns {Function} stream factory\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n* import randu from '@stdlib/random-base-randu';\n*\n* var arr = new Float64Array( 10 );\n* var i;\n* for ( i = 0; i < arr.length; i++ ) {\n* arr[ i ] = randu();\n* }\n*\n* var opts = {\n* 'sep': ',',\n* 'objectMode': false,\n* 'encoding': 'utf8',\n* 'highWaterMark': 64\n* };\n*\n* var createStream = factory( opts );\n*\n* // Create 10 identically configured streams...\n* var streams = [];\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( createStream( arr.length, arr, 1, 0 ) );\n* }\n*/\nfunction factory( options ) {\n\tvar opts;\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\topts = assign( {}, options );\n\t} else {\n\t\topts = {};\n\t}\n\treturn createStream;\n\n\t/**\n\t* Returns a readable stream from an array-like object.\n\t*\n\t* @private\n\t* @param {NonNegativeInteger} N - number of values to stream\n\t* @param {Collection} buffer - source array-like object\n\t* @param {integer} stride - stride length\n\t* @param {NonNegativeInteger} offset - starting index\n\t* @throws {TypeError} must provide an array-like object\n\t* @throws {TypeError} options argument must be an object\n\t* @throws {TypeError} must provide valid options\n\t* @returns {StridedArrayStream} Stream instance\n\t*/\n\tfunction createStream( N, buffer, stride, offset ) {\n\t\treturn new StridedArrayStream( N, buffer, stride, offset, opts );\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\nvar logger = require( 'debug' );\n\n\n// MAIN //\n\nvar debug = logger( 'join-stream' );\n\n\n// EXPORTS //\n\nexport default debug;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar Transform = require( 'readable-stream' ).Transform;\nimport string2buffer from '@stdlib/buffer-from-string';\nimport inherit from '@stdlib/utils-inherit';\nimport Buffer from '@stdlib/buffer-ctor';\nimport setNonEnumerable from '@stdlib/utils-define-nonenumerable-property';\nimport setNonEnumerableReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport nextTick from '@stdlib/utils-next-tick';\nimport defaults from './defaults.js';\nimport validate from './validate.js';\nimport debug from './debug.js';\n\n\n// FUNCTIONS //\n\n/**\n* Implements the `_transform` method.\n*\n* @private\n* @param {(Uint8Array|Buffer|string)} chunk - streamed chunk\n* @param {string} encoding - Buffer encoding\n* @param {Callback} clbk - callback to invoke after transforming the streamed chunk\n*/\nfunction transform( chunk, encoding, clbk ) {\n\t/* eslint-disable no-invalid-this */\n\tvar len;\n\n\tthis._idx += 1;\n\tdebug( 'Received a new chunk. Chunk: %s. Encoding: %s. Index: %d.', chunk.toString(), encoding, this._idx );\n\tif ( this._encoding === 'utf8' ) {\n\t\tif ( this._init ) {\n\t\t\tchunk = this._sep + chunk;\n\t\t} else {\n\t\t\tthis._init = true;\n\t\t}\n\t} else if ( this._init ) {\n\t\tchunk = new Buffer( chunk, encoding );\n\t\tlen = this._sep.length + chunk.length;\n\t\tchunk = Buffer.concat( [ this._sep, chunk ], len ); // TODO: replace with stdlib pkg\n\t\tchunk = chunk.toString( this._encoding );\n\t} else {\n\t\tthis._init = true;\n\t}\n\tthis.push( chunk, this._encoding );\n\tclbk();\n\n\t/* eslint-enable no-invalid-this */\n}\n\n/**\n* Implements the `_flush` method.\n*\n* @private\n* @param {Callback} clbk - callback to invoke after performing flush tasks\n*/\nfunction flush( clbk ) {\n\tdebug( 'Flushing the stream...' );\n\tclbk(); // TODO: consider supporting an option to append a final separator\n}\n\n/**\n* Gracefully destroys a stream, providing backward compatibility.\n*\n* @private\n* @param {Object} [error] - optional error message\n* @returns {JoinStream} Stream instance\n*/\nfunction destroy( error ) {\n\t/* eslint-disable no-invalid-this */\n\tvar self;\n\tif ( this._destroyed ) {\n\t\tdebug( 'Attempted to destroy an already destroyed stream.' );\n\t\treturn this;\n\t}\n\tself = this;\n\tthis._destroyed = true;\n\n\tnextTick( close );\n\n\treturn this;\n\n\t/**\n\t* Closes a stream.\n\t*\n\t* @private\n\t*/\n\tfunction close() {\n\t\tif ( error ) {\n\t\t\tdebug( 'Stream was destroyed due to an error. Error: %s.', JSON.stringify( error ) );\n\t\t\tself.emit( 'error', error );\n\t\t}\n\t\tdebug( 'Closing the stream...' );\n\t\tself.emit( 'close' );\n\t}\n\n\t/* eslint-enable no-invalid-this */\n}\n\n\n// MAIN //\n\n/**\n* Join stream constructor.\n*\n* @constructor\n* @param {Options} [options] - stream options\n* @param {string} [options.sep='\\n'] - separator used to join streamed data\n* @param {boolean} [options.objectMode=false] - specifies whether the stream should operate in object mode\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.allowHalfOpen=false] - specifies whether the stream should remain open even if one side ends\n* @param {boolean} [options.readableObjectMode=false] - specifies whether the readable side should be in object mode\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {JoinStream} join stream\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n*\n* function log( chunk ) {\n* console.log( chunk );\n* }\n*\n* var stream = new JoinStream();\n*\n* stream.pipe( inspectStream( log ) );\n*\n* stream.write( '1' );\n* stream.write( '2' );\n* stream.write( '3' );\n*\n* stream.end();\n*\n* // prints: '1\\n2\\n3'\n*/\nfunction JoinStream( options ) {\n\tvar opts;\n\tvar err;\n\tif ( !( this instanceof JoinStream ) ) {\n\t\tif ( arguments.length ) {\n\t\t\treturn new JoinStream( options );\n\t\t}\n\t\treturn new JoinStream();\n\t}\n\topts = defaults();\n\tif ( arguments.length ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t}\n\t// The stream's writable state should always be in object mode to prevent incoming data from being buffered (concatenated) and thus lose separation...\n\topts.writableObjectMode = true;\n\n\t// The stream converts each chunk into a string so no need to encode strings written to the join stream as Buffer objects:\n\topts.decodeStrings = false;\n\n\t// Make the stream a Transform stream:\n\tdebug( 'Creating a transform stream configured with the following options: %s.', JSON.stringify( opts ) );\n\tTransform.call( this, opts );\n\n\t// Destruction state:\n\tsetNonEnumerable( this, '_destroyed', false );\n\n\t// Cache the encoding:\n\tsetNonEnumerableReadOnly( this, '_encoding', ( opts.encoding === null ) ? 'utf8' : opts.encoding );\n\n\t// Cache the separator:\n\tif ( this._encoding !== 'utf8' ) {\n\t\topts.sep = string2buffer( opts.sep, this._encoding );\n\t}\n\tsetNonEnumerableReadOnly( this, '_sep', opts.sep );\n\n\t// Flag indicating if the stream has received streamed data:\n\tsetNonEnumerable( this, '_init', false );\n\n\t// Chunk counter:\n\tsetNonEnumerable( this, '_idx', -1 );\n\n\treturn this;\n}\n\n/*\n* Inherit from the `Transform` prototype.\n*/\ninherit( JoinStream, Transform );\n\n/**\n* Implements the `_transform` method.\n*\n* @private\n* @name _transform\n* @memberof JoinStream.prototype\n* @type {Function}\n* @param {(Buffer|string)} chunk - streamed chunk\n* @param {string} encoding - Buffer encoding\n* @param {Callback} clbk - callback to invoke after transforming the streamed chunk\n*/\nsetNonEnumerableReadOnly( JoinStream.prototype, '_transform', transform );\n\n/**\n* Implements the `_flush` method.\n*\n* @private\n* @name _flush\n* @memberof JoinStream.prototype\n* @type {Function}\n* @param {Callback} clbk - callback to invoke after performing flush tasks\n*/\nsetNonEnumerableReadOnly( JoinStream.prototype, '_flush', flush );\n\n/**\n* Gracefully destroys a stream, providing backward compatibility.\n*\n* @name destroy\n* @memberof JoinStream.prototype\n* @type {Function}\n* @param {Object} [error] - optional error message\n* @returns {JoinStream} Stream instance\n*/\nsetNonEnumerableReadOnly( JoinStream.prototype, 'destroy', destroy );\n\n\n// EXPORTS //\n\nexport default JoinStream;\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 default options.\n*\n* @private\n* @returns {Object} default options\n*\n* @example\n* var o = defaults();\n* // returns {...}\n*/\nfunction defaults() {\n\treturn {\n\t\t'objectMode': false,\n\t\t'encoding': null,\n\t\t'allowHalfOpen': false,\n\t\t'readableObjectMode': false,\n\t\t'sep': '\\n'\n\t};\n}\n\n\n// EXPORTS //\n\nexport default defaults;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isNonNegative } from '@stdlib/assert-is-nonnegative-number';\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.sep] - separator used to join streamed data\n* @param {boolean} [options.objectMode] - specifies whether a stream should operate in object mode\n* @param {(string|null)} [options.encoding] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.allowHalfOpen] - specifies whether the stream should remain open even if one side ends\n* @param {boolean} [options.readableObjectMode] - specifies whether the readable side should be in object mode\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'sep': '\\t',\n* 'objectMode': true\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, 'sep' ) ) {\n\t\topts.sep = options.sep;\n\t\tif ( !isString( opts.sep ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'sep', opts.sep ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'objectMode' ) ) {\n\t\topts.objectMode = options.objectMode;\n\t\tif ( !isBoolean( opts.objectMode ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'objectMode', opts.objectMode ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'readableObjectMode' ) ) {\n\t\topts.readableObjectMode = options.readableObjectMode;\n\t\tif ( !isBoolean( opts.readableObjectMode ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'readableObjectMode', opts.readableObjectMode ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'encoding' ) ) {\n\t\topts.encoding = options.encoding;\n\t\tif ( !isString( opts.encoding ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'encoding', opts.encoding ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'allowHalfOpen' ) ) {\n\t\topts.allowHalfOpen = options.allowHalfOpen;\n\t\tif ( !isBoolean( opts.allowHalfOpen ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'allowHalfOpen', opts.allowHalfOpen ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'highWaterMark' ) ) {\n\t\topts.highWaterMark = options.highWaterMark;\n\t\tif ( !isNonNegative( opts.highWaterMark ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a nonnegative number. Option: `%s`.', 'highWaterMark', opts.highWaterMark ) );\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/**\n* Transform stream which joins streamed data.\n*\n* @module @stdlib/streams-node-join\n*\n* @example\n* import stdout from '@stdlib/streams-node-stdout';\n* import joinStream from '@stdlib/streams-node-join';\n*\n* var stream = joinStream();\n*\n* stream.pipe( stdout );\n*\n* stream.write( '1' );\n* stream.write( '2' );\n* stream.write( '3' );\n*\n* stream.end();\n*\n* // prints: '1\\n2\\n3'\n*\n* @example\n* import joinStream from '@stdlib/streams-node-join';\n*\n* var opts = {\n* 'sep': '\\t',\n* 'objectMode': true,\n* 'encoding': 'utf8',\n* 'highWaterMark': 64\n* };\n*\n* var factory = joinStream.factory( opts );\n*\n* // Create 10 identically configured streams...\n* var streams = [];\n* var i;\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( factory() );\n* }\n*\n* @example\n* import stdout from '@stdlib/streams-node-stdout';\n* import joinStream from '@stdlib/streams-node-join';\n*\n* var stream = joinStream.objectMode({\n* 'sep': ','\n* });\n*\n* stream.pipe( stdout );\n*\n* stream.write( 'a' );\n* stream.write( 'b' );\n* stream.write( 'c' );\n*\n* stream.end();\n*\n* // prints: 'a,b,c'\n*/\n\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport objectMode from './object_mode.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'objectMode', objectMode );\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 isObject from '@stdlib/assert-is-plain-object';\nimport format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport Stream from './main.js';\n\n\n// MAIN //\n\n/**\n* Returns a join stream with `objectMode` set to `true`.\n*\n* @param {Options} [options] - stream options\n* @param {string} [options.sep='\\n'] - separator used to join streamed data\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.allowHalfOpen=false] - specifies whether the stream should remain open even if one side ends\n* @param {boolean} [options.readableObjectMode=false] - specifies whether the readable side should be in object mode\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {JoinStream} join stream\n*\n* @example\n* import inspectStream from '@stdlib/streams-node-inspect-sink';\n*\n* function log( chunk ) {\n* console.log( chunk.toString() );\n* }\n*\n* var stream = objectMode({\n* 'sep': ','\n* });\n*\n* stream.pipe( inspectStream( log ) );\n*\n* stream.write( 'a' );\n* stream.write( 'b' );\n* stream.write( 'c' );\n*\n* stream.end();\n*\n* // prints: 'a,b,c'\n*/\nfunction objectMode( options ) {\n\tvar opts;\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\topts = assign( {}, options );\n\t} else {\n\t\topts = {};\n\t}\n\topts.objectMode = true;\n\treturn new Stream( opts );\n}\n\n\n// EXPORTS //\n\nexport default objectMode;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport Stream from './main.js';\n\n\n// MAIN //\n\n/**\n* Creates a reusable join stream factory.\n*\n* @param {Options} [options] - stream options\n* @param {string} [options.sep='\\n'] - separator used to join streamed data\n* @param {boolean} [options.objectMode=false] - specifies whether a stream should operate in object mode\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.allowHalfOpen=false] - specifies whether the stream should remain open even if one side ends\n* @param {boolean} [options.readableObjectMode=false] - specifies whether the readable side should be in object mode\n* @throws {TypeError} options argument must be an object\n* @returns {Function} join stream factory\n*\n* @example\n* var opts = {\n* 'sep': '\\t',\n* 'objectMode': true,\n* 'encoding': 'utf8',\n* 'highWaterMark': 64\n* };\n*\n* var factory = streamFactory( opts );\n*\n* // Create 10 identically configured streams...\n* var streams = [];\n* var i;\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( factory() );\n* }\n*/\nfunction streamFactory( options ) {\n\tvar opts;\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\topts = assign( {}, options );\n\t} else {\n\t\topts = {};\n\t}\n\treturn joinStream;\n\n\t/**\n\t* Creates a transform stream for joining streamed data.\n\t*\n\t* @private\n\t* @throws {TypeError} must provide valid options\n\t* @returns {JoinStream} join stream\n\t*/\n\tfunction joinStream() {\n\t\treturn new Stream( opts );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default streamFactory;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 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 '@stdlib/assert-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) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// MAIN //\n\nvar debug = logger( 'split-stream' );\n\n\n// EXPORTS //\n\nexport default debug;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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';\n\n\n// MAIN //\n\n/**\n* Re-decodes a UTF-8 string according to a specified encoding.\n*\n* @private\n* @param {string} str - UTF-8 string to decode\n* @param {string} enc - string encoding\n* @returns {string} decoded string\n*/\nfunction decode( str, enc ) {\n\t// Check if we need to re-decode the string to something other than 'utf8'...\n\tif ( enc === 'utf8' || enc === 'buffer' ) {\n\t\treturn str;\n\t}\n\tstr = string2buffer( str );\n\tif ( enc ) {\n\t\treturn str.toString( enc );\n\t}\n\treturn str.toString();\n}\n\n\n// EXPORTS //\n\nexport default decode;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar Transform = require( 'readable-stream' ).Transform;\nimport assign from '@stdlib/object-assign';\nimport inherit from '@stdlib/utils-inherit';\nimport setNonEnumerable from '@stdlib/utils-define-nonenumerable-property';\nimport setNonEnumerableReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport Buffer from '@stdlib/buffer-ctor';\nimport nextTick from '@stdlib/utils-next-tick';\nimport DEFAULTS from './defaults.json';\nimport validate from './validate.js';\nimport debug from './debug.js';\nimport decode from './decode.js';\n\n\n// VARIABLES //\n\nvar RE = /\\r?\\n/;\n\n\n// FUNCTIONS //\n\n/**\n* Implements the `_transform` method.\n*\n* @private\n* @param {(Uint8Array|Buffer|string)} chunk - streamed chunk\n* @param {string} encoding - Buffer encoding\n* @param {Callback} clbk - callback to invoke after transforming the streamed chunk\n*/\nfunction transform( chunk, encoding, clbk ) {\n\t/* eslint-disable no-invalid-this */\n\tvar splits;\n\tvar split;\n\tvar len;\n\tvar i;\n\n\tthis._idx += 1;\n\tdebug( 'Received a new chunk. Chunk: %s. Encoding: %s. Index: %d.', chunk.toString(), encoding, this._idx );\n\tif ( encoding === 'buffer' ) {\n\t\t// Default Buffer decoding is 'utf8':\n\t\tchunk = chunk.toString();\n\t}\n\telse if ( encoding !== 'utf8' ) {\n\t\t// Decode the chunk as a 'utf8' string...\n\t\tchunk = new Buffer( chunk, encoding );\n\t\tchunk = chunk.toString( 'utf8' );\n\t}\n\t// Split the chunk:\n\tsplits = chunk.split( this._sep );\n\tdebug( 'Splits: %s. Index: %d.', JSON.stringify( splits ), this._idx );\n\n\t// How many splits do we have? We do not count the last \"split\", as it may be incomplete...\n\tlen = splits.length - 1;\n\tdebug( '%s splits. Index: %d.', len, this._idx );\n\n\t// If we do not have any splits, add the chunk to the buffer and wait for more data...\n\tif ( len === 0 ) {\n\t\tdebug( 'No splits. Index: %d.', this._idx );\n\t\tthis._buffer += splits[ len ];\n\t}\n\t// If we have split data, concat any previous partial split, re-decode (if need be) each split according to its original encoding, push each split to the destination, and set anything leftover as the new split buffer...\n\telse {\n\t\tdebug( 'Processing splits. Index: %d.', this._index );\n\t\tsplit = this._buffer + splits[ 0 ];\n\t\tsplit = decode( split, encoding );\n\n\t\tdebug( 'Split %d: %s. Index: %d.', 0, split.toString(), this._idx );\n\t\tthis.push( split, encoding );\n\t\tfor ( i = 1; i < len; i++ ) {\n\t\t\tsplit = decode( splits[ i ], encoding );\n\t\t\tdebug( 'Split %d: %s. Index: %d.', i, split.toString(), this._idx );\n\t\t\tthis.push( split, encoding );\n\t\t}\n\t\tdebug( 'Remaining split: %s.', splits[len].toString() );\n\t\tthis._buffer = splits[ len ];\n\t}\n\tclbk();\n\n\t/* eslint-enable no-invalid-this */\n}\n\n/**\n* Implements the `_flush` method.\n*\n* @private\n* @param {Callback} clbk - callback to invoke after any final processing\n*/\nfunction flush( clbk ) {\n\t/* eslint-disable no-invalid-this */\n\tvar split = this._buffer;\n\tif ( split ) {\n\t\tdebug( 'Processing final split...' );\n\t\tsplit = decode( split, this._encoding );\n\t\tthis.push( split, this._encoding );\n\t}\n\tdebug( 'Flushing the stream...' );\n\tclbk();\n\n\t/* eslint-enable no-invalid-this */\n}\n\n/**\n* Gracefully destroys a stream, providing backward compatibility.\n*\n* @private\n* @param {Object} [error] - optional error message\n* @returns {SplitStream} Stream instance\n*/\nfunction destroy( error ) {\n\t/* eslint-disable no-invalid-this */\n\tvar self;\n\tif ( this._destroyed ) {\n\t\tdebug( 'Attempted to destroy an already destroyed stream.' );\n\t\treturn this;\n\t}\n\tself = this;\n\tthis._destroyed = true;\n\n\tnextTick( close );\n\n\treturn this;\n\n\t/**\n\t* Closes a stream.\n\t*\n\t* @private\n\t*/\n\tfunction close() {\n\t\tif ( error ) {\n\t\t\tdebug( 'Stream was destroyed due to an error. Error: %s.', JSON.stringify( error ) );\n\t\t\tself.emit( 'error', error );\n\t\t}\n\t\tdebug( 'Closing the stream...' );\n\t\tself.emit( 'close' );\n\t}\n\n\t/* eslint-enable no-invalid-this */\n}\n\n\n// MAIN //\n\n/**\n* Split stream constructor.\n*\n* @constructor\n* @param {Options} [options] - stream options\n* @param {(string|RegExp)} [options.sep=/\\r?\\n/] - separator used to split streamed data\n* @param {boolean} [options.objectMode=false] - specifies whether a stream should operate in object mode\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.allowHalfOpen=false] - specifies whether the stream should remain open even if one side ends\n* @param {boolean} [options.writableObjectMode=false] - specifies whether the writable side should be in object mode\n* @returns {SplitStream} split stream\n*\n* @example\n* var stream = new SplitStream();\n*\n* stream.write( '1\\n2\\n3' );\n* stream.end();\n*/\nfunction SplitStream( options ) {\n\tvar opts;\n\tvar err;\n\tif ( !( this instanceof SplitStream ) ) {\n\t\tif ( arguments.length ) {\n\t\t\treturn new SplitStream( options );\n\t\t}\n\t\treturn new SplitStream();\n\t}\n\topts = assign( {}, DEFAULTS );\n\tif ( arguments.length ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t}\n\t// The stream's readable state should always be in object mode to prevent split data from being buffered (concatenated) and no longer being separated...\n\topts.readableObjectMode = true;\n\n\t// The stream converts each chunk into a string so no need to encode strings written to the split stream as Buffer objects:\n\topts.decodeStrings = false;\n\n\t// Make the stream a Transform stream:\n\tdebug( 'Creating a transform stream configured with the following options: %s.', JSON.stringify( opts ) );\n\tTransform.call( this, opts );\n\n\t// Cache the separator:\n\tsetNonEnumerableReadOnly( this, '_sep', ( opts.sep === null ) ? RE : opts.sep );\n\n\t// The destruction state:\n\tsetNonEnumerable( this, '_destroyed', false );\n\n\t// Cache the encoding:\n\tsetNonEnumerableReadOnly( this, '_encoding', opts.encoding );\n\n\t// Buffer for storing partial splits:\n\tsetNonEnumerable( this, '_buffer', '' );\n\n\t// Chunk counter:\n\tsetNonEnumerable( this, '_idx', -1 );\n\n\treturn this;\n}\n\n/*\n* Inherit from the `Transform` prototype.\n*/\ninherit( SplitStream, Transform );\n\n/**\n* Implements the `_transform` method.\n*\n* @private\n* @name _transform\n* @memberof SplitStream.prototype\n* @type {Function}\n* @param {(Buffer|string)} chunk - streamed chunk\n* @param {string} encoding - Buffer encoding\n* @param {Callback} clbk - callback to invoke after transforming the streamed chunk\n*/\nsetNonEnumerableReadOnly( SplitStream.prototype, '_transform', transform );\n\n/**\n* Implements the `_flush` method.\n*\n* @private\n* @name _flush\n* @memberof SplitStream.prototype\n* @type {Function}\n* @param {Callback} clbk - callback to invoke after any final processing\n*/\nsetNonEnumerableReadOnly( SplitStream.prototype, '_flush', flush );\n\n/**\n* Gracefully destroys a stream, providing backward compatibility.\n*\n* @name destroy\n* @memberof SplitStream.prototype\n* @type {Function}\n* @param {Object} [error] - optional error message\n* @returns {SplitStream} Stream instance\n*/\nsetNonEnumerableReadOnly( SplitStream.prototype, 'destroy', destroy );\n\n\n// EXPORTS //\n\nexport default SplitStream;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isNonNegative } from '@stdlib/assert-is-nonnegative-number';\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport isRegExp from '@stdlib/assert-is-regexp';\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|RegExp)} [options.sep] - separator used to split streamed data\n* @param {boolean} [options.objectMode] - specifies whether stream should operate in object mode\n* @param {(string|null)} [options.encoding] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.allowHalfOpen] - specifies whether the stream should remain open even if one side ends\n* @param {boolean} [options.writableObjectMode] - specifies whether the writable side should be in object mode\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'sep': '\\t',\n* 'objectMode': true\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, 'sep' ) ) {\n\t\topts.sep = options.sep;\n\t\tif (\n\t\t\t!isString( opts.sep ) &&\n\t\t\t!isRegExp( opts.sep )\n\t\t) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be either a string or a regular expression. Option: `%s`.', 'sep', opts.sep ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'objectMode' ) ) {\n\t\topts.objectMode = options.objectMode;\n\t\tif ( !isBoolean( opts.objectMode ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'objectMode', opts.objectMode ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'writableObjectMode' ) ) {\n\t\topts.writableObjectMode = options.writableObjectMode;\n\t\tif ( !isBoolean( opts.writableObjectMode ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'writableObjectMode', opts.writableObjectMode ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'encoding' ) ) {\n\t\topts.encoding = options.encoding;\n\t\tif ( !isString( opts.encoding ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'encoding', opts.encoding ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'allowHalfOpen' ) ) {\n\t\topts.allowHalfOpen = options.allowHalfOpen;\n\t\tif ( !isBoolean( opts.allowHalfOpen ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'allowHalfOpen', opts.allowHalfOpen ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'highWaterMark' ) ) {\n\t\topts.highWaterMark = options.highWaterMark;\n\t\tif ( !isNonNegative( opts.highWaterMark ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a nonnegative number. Option: `%s`.', 'highWaterMark', opts.highWaterMark ) );\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/**\n* Transform stream which splits streamed data.\n*\n* @module @stdlib/streams-node-split\n*\n* @example\n* import stdout from '@stdlib/streams-node-stdout';\n* import splitStream from '@stdlib/streams-node-split';\n*\n* var stream = splitStream();\n*\n* stream.pipe( stdout );\n*\n* stream.write( '1\\n2\\n3' );\n* stream.end();\n* // => '1' => '2' => '3'\n*\n* @example\n* import splitStream from '@stdlib/streams-node-split';\n*\n* var opts = {\n* 'sep': '\\t',\n* 'objectMode': true,\n* 'encoding': 'utf8',\n* 'highWaterMark': 64\n* };\n*\n* var factory = splitStream.factory( opts );\n*\n* // Create 10 identically configured streams...\n* var streams = [];\n* var i;\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( factory() );\n* }\n*\n* @example\n* import stdout from '@stdlib/streams-node-stdout';\n* import splitStream from '@stdlib/streams-node-split';\n*\n* var stream = splitStream.objectMode({\n* 'sep': ','\n* });\n*\n* stream.pipe( stdout );\n*\n* stream.write( 'a,b,c' );\n* stream.end();\n* // => 'a' => 'b' => 'c'\n*/\n\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport objectMode from './object_mode.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'objectMode', objectMode );\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 isObject from '@stdlib/assert-is-plain-object';\nimport format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport Stream from './main.js';\n\n\n// MAIN //\n\n/**\n* Returns a stream with `objectMode` set to `true`.\n*\n* @param {Options} [options] - stream options\n* @param {(string|RegExp)} [options.sep=/\\r?\\n/] - separator used to split streamed data\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.allowHalfOpen=false] - specifies whether the stream should remain open even if one side ends\n* @param {boolean} [options.writableObjectMode=false] - specifies whether the writable side should be in object mode\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {SplitStream} split stream\n*\n* @example\n* var stream = objectMode({\n* 'sep': ','\n* });\n*\n* stream.write( 'a,b,c' );\n* stream.end();\n*/\nfunction objectMode( options ) {\n\tvar opts;\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\topts = assign( {}, options );\n\t} else {\n\t\topts = {};\n\t}\n\topts.objectMode = true;\n\treturn new Stream( opts );\n}\n\n\n// EXPORTS //\n\nexport default objectMode;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport Stream from './main.js';\n\n\n// MAIN //\n\n/**\n* Creates a reusable stream factory.\n*\n* @param {Options} [options] - stream options\n* @param {(string|RegExp)} [options.sep=/\\r?\\n/] - separator used to split streamed data\n* @param {boolean} [options.objectMode=false] - specifies whether a stream should operate in object mode\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.allowHalfOpen=false] - specifies whether the stream should remain open even if one side ends\n* @param {boolean} [options.writableObjectMode=false] - specifies whether the writable side should be in object mode\n* @throws {TypeError} options argument must be an object\n* @returns {Function} stream factory\n*\n* @example\n* var opts = {\n* 'sep': '\\t',\n* 'objectMode': true,\n* 'encoding': 'utf8'\n* };\n*\n* var factory = streamFactory( opts );\n*\n* // Create 10 identically configured streams...\n* var streams = [];\n* var i;\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( factory() );\n* }\n*/\nfunction streamFactory( options ) {\n\tvar opts;\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\topts = assign( {}, options );\n\t} else {\n\t\topts = {};\n\t}\n\treturn splitStream;\n\n\t/**\n\t* Creates a transform stream for splitting streamed data.\n\t*\n\t* @private\n\t* @throws {TypeError} must provide valid options\n\t* @returns {SplitStream} split stream\n\t*/\n\tfunction splitStream() {\n\t\treturn new Stream( opts );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default streamFactory;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar proc = require( 'process' );\n\n\n// EXPORTS //\n\nexport default proc.stderr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar proc = require( 'process' );\n\n\n// EXPORTS //\n\nexport default proc.stdin;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar proc = require( 'process' );\n\n\n// EXPORTS //\n\nexport default proc.stdout;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isFunction from '@stdlib/assert-is-function';\nimport { isPrimitive as isBoolean } from '@stdlib/assert-is-boolean';\nimport { isPrimitive as isNonNegative } from '@stdlib/assert-is-nonnegative-number';\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 {Function} [options.transform] - callback to invoke upon receiving a new chunk\n* @param {Function} [options.flush] - callback to invoke after receiving all chunks and prior to the stream closing\n* @param {boolean} [options.objectMode] - specifies whether a stream should operate in object mode\n* @param {(string|null)} [options.encoding] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.allowHalfOpen] - specifies whether the stream should remain open even if one side ends\n* @param {boolean} [options.decodeStrings] - specifies whether to decode `strings` into `Buffer` objects when writing\n* @returns {(Error|null)} null or an error object\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, 'transform' ) ) {\n\t\topts.transform = options.transform;\n\t\tif ( !isFunction( opts.transform ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a function. Option: `%s`.', 'transform', opts.transform ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'flush' ) ) {\n\t\topts.flush = options.flush;\n\t\tif ( !isFunction( opts.flush ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a function. Option: `%s`.', 'flush', opts.flush ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'objectMode' ) ) {\n\t\topts.objectMode = options.objectMode;\n\t\tif ( !isBoolean( opts.objectMode ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'objectMode', opts.objectMode ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'encoding' ) ) {\n\t\topts.encoding = options.encoding;\n\t\tif ( !isString( opts.encoding ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'encoding', opts.encoding ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'allowHalfOpen' ) ) {\n\t\topts.allowHalfOpen = options.allowHalfOpen;\n\t\tif ( !isBoolean( opts.allowHalfOpen ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'allowHalfOpen', opts.allowHalfOpen ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'highWaterMark' ) ) {\n\t\topts.highWaterMark = options.highWaterMark;\n\t\tif ( !isNonNegative( opts.highWaterMark ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a nonnegative number. Option: `%s`.', 'highWaterMark', opts.highWaterMark ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'decodeStrings' ) ) {\n\t\topts.decodeStrings = options.decodeStrings;\n\t\tif ( !isBoolean( opts.decodeStrings ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'decodeStrings', opts.decodeStrings ) );\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\nvar logger = require( 'debug' );\nimport nextTick from '@stdlib/utils-next-tick';\n\n\n// VARIABLES //\n\nvar debug = logger( 'transform-stream:destroy' );\n\n\n// MAIN //\n\n/**\n* Gracefully destroys a stream, providing backward compatibility.\n*\n* @private\n* @param {Object} [error] - optional error message\n* @returns {Stream} stream instance\n*/\nfunction destroy( error ) {\n\t/* eslint-disable no-invalid-this */\n\tvar self;\n\tif ( this._destroyed ) {\n\t\tdebug( 'Attempted to destroy an already destroyed stream.' );\n\t\treturn this;\n\t}\n\tself = this;\n\tthis._destroyed = true;\n\n\tnextTick( close );\n\n\treturn this;\n\n\t/**\n\t* Closes a stream.\n\t*\n\t* @private\n\t*/\n\tfunction close() {\n\t\tif ( error ) {\n\t\t\tdebug( 'Stream was destroyed due to an error. Error: %s.', JSON.stringify( error ) );\n\t\t\tself.emit( 'error', error );\n\t\t}\n\t\tdebug( 'Closing the stream...' );\n\t\tself.emit( 'close' );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default destroy;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'transform-stream:transform' );\n\n\n// MAIN //\n\n/**\n* Implements the `_transform` method as a pass through.\n*\n* @private\n* @param {(Uint8Array|Buffer|string)} chunk - streamed chunk\n* @param {string} encoding - Buffer encoding\n* @param {Callback} clbk - callback to invoke after transforming the streamed chunk\n*/\nfunction transform( chunk, encoding, clbk ) {\n\tdebug( 'Received a new chunk. Chunk: %s. Encoding: %s.', chunk.toString(), encoding );\n\tclbk( null, chunk );\n}\n\n\n// EXPORTS //\n\nexport default transform;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nvar Transform = require( 'readable-stream' ).Transform;\nimport inherit from '@stdlib/utils-inherit';\nimport assign from '@stdlib/object-assign';\nimport DEFAULTS from './defaults.json';\nimport validate from './validate.js';\nimport destroy from './destroy.js';\nimport _transform from './_transform.js'; // eslint-disable-line no-underscore-dangle\n\n\n// VARIABLES //\n\nvar debug = logger( 'transform-stream:main' );\n\n\n// MAIN //\n\n/**\n* Transform stream constructor.\n*\n* @constructor\n* @param {Options} [options] - stream options\n* @param {Function} [options.transform] - callback to invoke upon receiving a new chunk\n* @param {Function} [options.flush] - callback to invoke after receiving all chunks and prior to the stream closing\n* @param {boolean} [options.objectMode=false] - specifies whether stream should operate in object mode\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.allowHalfOpen=false] - specifies whether the stream should remain open even if one side ends\n* @param {boolean} [options.decodeStrings=true] - specifies whether to decode `strings` into `Buffer` objects when writing\n* @throws {TypeError} must provide valid options\n* @returns {TransformStream} transform stream\n*\n* @example\n* import stdout from '@stdlib/streams-node-stdout';\n*\n* function transform( chunk, enc, clbk ) {\n* clbk( null, chunk.toString()+'\\n' );\n* }\n*\n* var opts = {\n* 'transform': transform\n* };\n* var stream = new TransformStream( opts );\n*\n* stream.pipe( stdout );\n*\n* stream.write( '1' );\n* stream.write( '2' );\n* stream.write( '3' );\n*\n* stream.end();\n*\n* // prints: '1\\n2\\n3\\n'\n*/\nfunction TransformStream( options ) { // eslint-disable-line stdlib/no-redeclare\n\tvar opts;\n\tvar err;\n\tif ( !( this instanceof TransformStream ) ) {\n\t\tif ( arguments.length ) {\n\t\t\treturn new TransformStream( options );\n\t\t}\n\t\treturn new TransformStream();\n\t}\n\topts = assign( {}, DEFAULTS );\n\tif ( arguments.length ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t}\n\tdebug( 'Creating a transform stream configured with the following options: %s.', JSON.stringify( opts ) );\n\tTransform.call( this, opts );\n\tthis._destroyed = false;\n\tif ( opts.transform ) {\n\t\tthis._transform = opts.transform;\n\t} else {\n\t\tthis._transform = _transform;\n\t}\n\tif ( opts.flush ) {\n\t\tthis._flush = opts.flush;\n\t}\n\treturn this;\n}\n\n/*\n* Inherit from the `Transform` prototype.\n*/\ninherit( TransformStream, Transform );\n\n/**\n* Gracefully destroys a stream, providing backward compatibility.\n*\n* @name destroy\n* @memberof TransformStream.prototype\n* @type {Function}\n* @param {Object} [error] - optional error message\n* @returns {TransformStream} stream instance\n*/\nTransformStream.prototype.destroy = destroy;\n\n\n// EXPORTS //\n\nexport default TransformStream;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nvar Transform = require( 'readable-stream' ).Transform;\nimport inherit from '@stdlib/utils-inherit';\nimport assign from '@stdlib/object-assign';\nimport DEFAULTS from './defaults.json';\nimport validate from './validate.js';\nimport destroy from './destroy.js';\nimport _transform from './_transform.js'; // eslint-disable-line no-underscore-dangle\n\n\n// VARIABLES //\n\nvar debug = logger( 'transform-stream:ctor' );\n\n\n// MAIN //\n\n/**\n* Transform stream constructor factory.\n*\n* @param {Options} [options] - stream options\n* @param {Function} [options.transform] - callback to invoke upon receiving a new chunk\n* @param {Function} [options.flush] - callback to invoke after receiving all chunks and prior to the stream closing\n* @param {boolean} [options.objectMode=false] - specifies whether a stream should operate in object mode\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.allowHalfOpen=false] - specifies whether the stream should remain open even if one side ends\n* @param {boolean} [options.decodeStrings=true] - specifies whether to decode `strings` into `Buffer` objects when writing\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {Function} Transform stream constructor\n*\n* @example\n* import stdout from '@stdlib/streams-node-stdout';\n*\n* function transform( chunk, enc, clbk ) {\n* clbk( null, chunk.toString()+'\\n' );\n* }\n*\n* var opts = {\n* 'transform': transform\n* };\n*\n* var TransformStream = ctor( opts );\n*\n* var stream = new TransformStream();\n*\n* stream.pipe( stdout );\n*\n* stream.write( '1' );\n* stream.write( '2' );\n* stream.write( '3' );\n*\n* stream.end();\n*\n* // prints: '1\\n2\\n3\\n'\n*/\nfunction ctor( options ) {\n\tvar transform;\n\tvar copts;\n\tvar err;\n\n\tcopts = assign( {}, DEFAULTS );\n\tif ( arguments.length ) {\n\t\terr = validate( copts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t}\n\tif ( copts.transform ) {\n\t\ttransform = copts.transform;\n\t} else {\n\t\ttransform = _transform;\n\t}\n\t/**\n\t* Transform stream constructor.\n\t*\n\t* @private\n\t* @constructor\n\t* @param {Options} [options] - stream options\n\t* @param {boolean} [options.objectMode=false] - specifies whether a stream should operate in object mode\n\t* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to `strings`\n\t* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n\t* @param {boolean} [options.allowHalfOpen=false] - specifies whether the stream should remain open even if one side ends\n\t* @param {boolean} [options.decodeStrings=true] - specifies whether to decode `strings` into `Buffer` objects when writing\n\t* @throws {TypeError} options argument must be an object\n\t* @throws {TypeError} must provide valid options\n\t* @returns {TransformStream} transform stream\n\t*\n\t* @example\n\t* import stdout from '@stdlib/streams-node-stdout';\n\t*\n\t* var stream = new TransformStream();\n\t*\n\t* stream.pipe( stdout );\n\t*\n\t* stream.write( '1' );\n\t* stream.write( '2' );\n\t* stream.write( '3' );\n\t*\n\t* stream.end();\n\t*\n\t* // prints: '1\\n2\\n3\\n'\n\t*/\n\tfunction TransformStream( options ) {\n\t\tvar opts;\n\t\tvar err;\n\t\tif ( !( this instanceof TransformStream ) ) {\n\t\t\tif ( arguments.length ) {\n\t\t\t\treturn new TransformStream( options );\n\t\t\t}\n\t\t\treturn new TransformStream();\n\t\t}\n\t\topts = assign( {}, copts );\n\t\tif ( arguments.length ) {\n\t\t\terr = validate( opts, options );\n\t\t\tif ( err ) {\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t}\n\t\tdebug( 'Creating a transform stream configured with the following options: %s.', JSON.stringify( opts ) );\n\t\tTransform.call( this, opts );\n\t\tthis._destroyed = false;\n\t\treturn this;\n\t}\n\n\t/**\n\t* Inherit from the `Transform` prototype.\n\t*/\n\tinherit( TransformStream, Transform );\n\n\t/**\n\t* Implements the `_transform` method.\n\t*\n\t* @private\n\t* @name _transform\n\t* @memberof TransformStream.prototype\n\t* @type {Function}\n\t* @param {(Buffer|string)} chunk - streamed chunk\n\t* @param {string} encoding - Buffer encoding\n\t* @param {Callback} clbk - callback to invoke after transforming the streamed chunk\n\t*/\n\tTransformStream.prototype._transform = transform; // eslint-disable-line no-underscore-dangle\n\n\tif ( copts.flush ) {\n\t\t/**\n\t\t* Implements the `_flush` method.\n\t\t*\n\t\t* @private\n\t\t* @name _flush\n\t\t* @memberof TransformStream.prototype\n\t\t* @type {Function}\n\t\t* @param {Callback} callback to invoke after performing flush tasks\n\t\t*/\n\t\tTransformStream.prototype._flush = copts.flush; // eslint-disable-line no-underscore-dangle\n\t}\n\n\t/**\n\t* Gracefully destroys a stream, providing backward compatibility.\n\t*\n\t* @private\n\t* @name destroy\n\t* @memberof TransformStream.prototype\n\t* @type {Function}\n\t* @param {Object} [error] - optional error message\n\t* @returns {TransformStream} stream instance\n\t*/\n\tTransformStream.prototype.destroy = destroy;\n\n\treturn TransformStream;\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* Transform stream.\n*\n* @module @stdlib/streams-node-transform\n*\n* @example\n* import stdout from '@stdlib/streams-node-stdout';\n* import transformStream from '@stdlib/streams-node-transform';\n*\n* function transform( chunk, enc, clbk ) {\n* clbk( null, chunk.toString()+'\\n' );\n* }\n*\n* var opts = {\n* 'transform': transform\n* };\n* var stream = transformStream( opts );\n*\n* stream.pipe( stdout );\n*\n* stream.write( '1' );\n* stream.write( '2' );\n* stream.write( '3' );\n*\n* stream.end();\n* // => '1\\n2\\n3\\n'\n*\n* @example\n* import transformStream from '@stdlib/streams-node-transform';\n*\n* function transform( chunk, enc, clbk ) {\n* clbk( null, chunk.toString()+'\\n' );\n* }\n*\n* var opts = {\n* 'objectMode': true,\n* 'encoding': 'utf8',\n* 'highWaterMark': 64,\n* 'decodeStrings': false\n* };\n*\n* var factory = transformStream.factory( opts );\n*\n* // Create 10 identically configured streams...\n* var streams = [];\n* var i;\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( factory( transform ) );\n* }\n*\n* @example\n* import stdout from '@stdlib/streams-node-stdout';\n* import transformStream from '@stdlib/streams-node-transform';\n*\n* function stringify( chunk, enc, clbk ) {\n* clbk( null, JSON.stringify( chunk ) );\n* }\n*\n* function newline( chunk, enc, clbk ) {\n* clbk( null, chunk+'\\n' );\n* }\n*\n* var s1 = transformStream.objectMode({\n* 'transform': stringify\n* });\n*\n* var s2 = transformStream.objectMode({\n* 'transform': newline\n* });\n*\n* s1.pipe( s2 ).pipe( stdout );\n*\n* s1.write( {'value': 'a'} );\n* s1.write( {'value': 'b'} );\n* s1.write( {'value': 'c'} );\n*\n* s1.end();\n* // => '{\"value\":\"a\"}\\n{\"value\":\"b\"}\\n{\"value\":\"c\"}\\n'\n*\n* @example\n* import stdout from '@stdlib/streams-node-stdout';\n* import transformStream from '@stdlib/streams-node-transform';\n*\n* function transform( chunk, enc, clbk ) {\n* clbk( null, chunk.toString()+'\\n' );\n* }\n*\n* var opts = {\n* 'transform': transform\n* };\n*\n* var Stream = transformStream.ctor( opts );\n*\n* var stream = new Stream();\n*\n* stream.pipe( stdout );\n*\n* stream.write( '1' );\n* stream.write( '2' );\n* stream.write( '3' );\n*\n* stream.end();\n* // => '1\\n2\\n3\\n'\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport objectMode from './object_mode.js';\nimport factory from './factory.js';\nimport ctor from './ctor.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'objectMode', objectMode );\nsetReadOnly( main, 'factory', factory );\nsetReadOnly( main, 'ctor', ctor );\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 isObject from '@stdlib/assert-is-plain-object';\nimport format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport Stream from './main.js';\n\n\n// MAIN //\n\n/**\n* Returns a transform stream with `objectMode` set to `true`.\n*\n* @param {Options} [options] - stream options\n* @param {Function} [options.transform] - callback to invoke upon receiving a new chunk\n* @param {Function} [options.flush] - callback to invoke after receiving all chunks and prior to the stream closing\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.allowHalfOpen=false] - specifies whether the stream should remain open even if one side ends\n* @param {boolean} [options.decodeStrings=true] - specifies whether to decode `strings` into `Buffer` objects when writing\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {TransformStream} transform stream\n*\n* @example\n* import stdout from '@stdlib/streams-node-stdout';\n*\n* function stringify( chunk, enc, clbk ) {\n* clbk( null, JSON.stringify( chunk ) );\n* }\n*\n* function newline( chunk, enc, clbk ) {\n* clbk( null, chunk+'\\n' );\n* }\n*\n* var s1 = objectMode({\n* 'transform': stringify\n* });\n*\n* var s2 = objectMode({\n* 'transform': newline\n* });\n*\n* s1.pipe( s2 ).pipe( stdout );\n*\n* s1.write( {'value': 'a'} );\n* s1.write( {'value': 'b'} );\n* s1.write( {'value': 'c'} );\n*\n* s1.end();\n*\n* // prints: '{\"value\":\"a\"}\\n{\"value\":\"b\"}\\n{\"value\":\"c\"}\\n'\n*/\nfunction objectMode( options ) {\n\tvar opts;\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\topts = assign( {}, options );\n\t} else {\n\t\topts = {};\n\t}\n\topts.objectMode = true;\n\treturn new Stream( opts );\n}\n\n\n// EXPORTS //\n\nexport default objectMode;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 format from '@stdlib/string-format';\nimport assign from '@stdlib/object-assign';\nimport Stream from './main.js';\n\n\n// MAIN //\n\n/**\n* Creates a reusable transform stream factory.\n*\n* @param {Options} [options] - stream options\n* @param {boolean} [options.objectMode=false] - specifies whether a stream should operate in object mode\n* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to `strings`\n* @param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`\n* @param {boolean} [options.allowHalfOpen=false] - specifies whether the stream should remain open even if one side ends\n* @param {boolean} [options.decodeStrings=true] - specifies whether to decode `strings` into `Buffer` objects when writing\n* @throws {TypeError} options argument must be an object\n* @returns {Function} transform stream factory\n*\n* @example\n* function transform( chunk, enc, clbk ) {\n* clbk( null, chunk.toString()+'\\n' );\n* }\n*\n* var opts = {\n* 'objectMode': true,\n* 'encoding': 'utf8',\n* 'highWaterMark': 64,\n* 'decodeStrings': false\n* };\n*\n* var factory = streamFactory( opts );\n*\n* // Create 10 identically configured streams...\n* var streams = [];\n* var i;\n* for ( i = 0; i < 10; i++ ) {\n* streams.push( factory( transform ) );\n* }\n*/\nfunction streamFactory( options ) {\n\tvar opts;\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\topts = assign( {}, options );\n\t} else {\n\t\topts = {};\n\t}\n\treturn createStream;\n\n\t/**\n\t* Creates a transform stream.\n\t*\n\t* @private\n\t* @param {Function} transform - callback to invoke upon receiving a new chunk\n\t* @param {Function} [flush] - callback to invoke after receiving all chunks and prior to the stream closing\n\t* @throws {TypeError} must provide valid options\n\t* @throws {TypeError} transform callback must be a function\n\t* @throws {TypeError} flush callback must be a function\n\t* @returns {TransformStream} transform stream\n\t*/\n\tfunction createStream( transform, flush ) {\n\t\topts.transform = transform;\n\t\tif ( arguments.length > 1 ) {\n\t\t\topts.flush = flush;\n\t\t} else {\n\t\t\tdelete opts.flush; // clear any previous `flush`\n\t\t}\n\t\treturn new Stream( opts );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default streamFactory;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\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 streams\n*/\nvar streams = {};\n\n/**\n* @name debugStream\n* @memberof streams\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/streams/node/debug}\n*/\nimport debugStream from '@stdlib/streams-node-debug';\nsetReadOnly( streams, 'debugStream', debugStream );\n\n/**\n* @name debugSinkStream\n* @memberof streams\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/streams/node/debug-sink}\n*/\nimport debugSinkStream from '@stdlib/streams-node-debug-sink';\nsetReadOnly( streams, 'debugSinkStream', debugSinkStream );\n\n/**\n* @name emptyStream\n* @memberof streams\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/streams/node/empty}\n*/\nimport emptyStream from '@stdlib/streams-node-empty';\nsetReadOnly( streams, 'emptyStream', emptyStream );\n\n/**\n* @name arrayStream\n* @memberof streams\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/streams/node/from-array}\n*/\nimport arrayStream from '@stdlib/streams-node-from-array';\nsetReadOnly( streams, 'arrayStream', arrayStream );\n\n/**\n* @name circularArrayStream\n* @memberof streams\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/streams/node/from-circular-array}\n*/\nimport circularArrayStream from '@stdlib/streams-node-from-circular-array';\nsetReadOnly( streams, 'circularArrayStream', circularArrayStream );\n\n/**\n* @name constantStream\n* @memberof streams\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/streams/node/from-constant}\n*/\nimport constantStream from '@stdlib/streams-node-from-constant';\nsetReadOnly( streams, 'constantStream', constantStream );\n\n/**\n* @name iteratorStream\n* @memberof streams\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/streams/node/from-iterator}\n*/\nimport iteratorStream from '@stdlib/streams-node-from-iterator';\nsetReadOnly( streams, 'iteratorStream', iteratorStream );\n\n/**\n* @name stridedArrayStream\n* @memberof streams\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/streams/node/from-strided-array}\n*/\nimport stridedArrayStream from '@stdlib/streams-node-from-strided-array';\nsetReadOnly( streams, 'stridedArrayStream', stridedArrayStream );\n\n/**\n* @name inspectStream\n* @memberof streams\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/streams/node/inspect}\n*/\nimport inspectStream from '@stdlib/streams-node-inspect';\nsetReadOnly( streams, 'inspectStream', inspectStream );\n\n/**\n* @name inspectSinkStream\n* @memberof streams\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/streams/node/inspect-sink}\n*/\nimport inspectSinkStream from '@stdlib/streams-node-inspect-sink';\nsetReadOnly( streams, 'inspectSinkStream', inspectSinkStream );\n\n/**\n* @name joinStream\n* @memberof streams\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/streams/node/join}\n*/\nimport joinStream from '@stdlib/streams-node-join';\nsetReadOnly( streams, 'joinStream', joinStream );\n\n/**\n* @name splitStream\n* @memberof streams\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/streams/node/split}\n*/\nimport splitStream from '@stdlib/streams-node-split';\nsetReadOnly( streams, 'splitStream', splitStream );\n\n/**\n* @name stderr\n* @memberof streams\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/streams/node/stderr}\n*/\nimport stderr from '@stdlib/streams-node-stderr';\nsetReadOnly( streams, 'stderr', stderr );\n\n/**\n* @name stdin\n* @memberof streams\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/streams/node/stdin}\n*/\nimport stdin from '@stdlib/streams-node-stdin';\nsetReadOnly( streams, 'stdin', stdin );\n\n/**\n* @name stdout\n* @memberof streams\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/streams/node/stdout}\n*/\nimport stdout from '@stdlib/streams-node-stdout';\nsetReadOnly( streams, 'stdout', stdout );\n\n/**\n* @name transformStream\n* @memberof streams\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/streams/node/transform}\n*/\nimport transformStream from '@stdlib/streams-node-transform';\nsetReadOnly( streams, 'transformStream', transformStream );\n\n\n// EXPORTS //\n\nexport default streams;\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","digits","f","parseFloat","toExponential","toFixed","toPrecision","spaces","fromCharCode","isArray","Array","isnan","initialize","flags","mapping","formatInterpolate","tokens","hasPeriod","flag","num","pos","j","TypeError","padZeros","indexOf","arguments","maxWidth","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","isBoolean","FLG","Symbol","hasToStringTagSupport","toStringTag","has","hasOwnProperty","hasOwnProp","property","Sym","toStrTag","nativeClass","hasToStringTag","v","isOwn","tag","Bool","Boolean","test","isPrimitive","isObject","self","window","global","globalThis","getGlobal","codegen","Function","GlobalThis","Self","Win","Global","root","nodeList","document","childNodes","typedarray","Int8Array","reFunctionName","RE_FUNCTION_NAME","REGEXP","main$9","isObjectLike","isObjectLikeArray","predicate","len","arrayfun","isBuffer","_isBuffer","constructor","constructorName","name","ctor","ctorName","type","isFunction","typeOf","bool","assign","keys","isArguments","bool$a","detect","hasArgumentsClass","isString","valueOf","main$7","Number","x","isNan","FLOAT64_PINF","POSITIVE_INFINITY","FLOAT64_NINF","NEGATIVE_INFINITY","floor","isInteger","PINF","NINF","isInt","isEnumerableProperty","propertyIsEnumerable","hasStringEnumBug","isEnum","isArguments$1","MAX_TYPED_ARRAY_LENGTH","isCollection","MAX_LENGTH","arr","searchElement","fromIndex","isConstructorPrototype","w","hasAutomationEqualityBug","k","win","EXCLUDED_KEYS","check","HAS_BUILTIN","skipConstructor","skipPrototype","isFcn","p","HAS_ENUM_PROTO_BUG","HAS_NON_ENUM_PROPS_BUG","HAS_WINDOW","error","NON_ENUMERABLE","main$6","getOwnPropertySymbols","Obj","propertySymbols","enumerableProperties","tmp","isEnumerable","hasObjectAssign","target","source","key","to","assign$1","validate","create","Ctor","createObject$1","proto","inherit","superCtor","createObject","setNonEnumerableProperty","proc","require$$0","nextTick","clbk","getProto","getPrototypeOf","getProto$1","objectPrototype","isPlainObject","isPrototypeOf","ownProps","isNonNegativeNumber","debug","Transform","InspectStream","options","inspect","opts","this","DEFAULTS","objectMode","readableObjectMode","allowHalfOpen","highWaterMark","isNonNegative","writableObjectMode","JSON","stringify","setNonEnumerable","chunk","encoding","_idx","_inspect","_destroyed","emit","cb","Stream","NAMESPACE$1","NAMESPACE","DebugStream","log","logger","idx","Writable","InspectSinkStream","decodeStrings","defaultEncoding","DebugSinkStream","isError","Readable","EmptyStream","message","Buffer","b","GlobalBuffer","from","hasNodeBufferSupport","string2buffer","Buffer$1","string2buffer$1","ArrayStream","src","sep","serialize","dir","_i","_src","_stride","_objectMode","_serialize","_sep","concat","isNonNegativeInteger","CircularArrayStream","iter","_iter","hasUint8Array","Uint8Array","isUint8Array","globalScope$1","fcn","VERSION","globalScope","versions","node","release","MAJOR","IS_NODE","split","version","hasArrayBuffer","ArrayBuffer","isArrayBuffer","GlobalUint8Array","UINT8_MAX","hasUint8ArraySupport","Uint8Array$1","arraybuffer2buffer","fromArray","hasFrom","buf","byteOffset","offset","byteLength","RangeError","arraybuffer2buffer$1","ConstantStream","buffer","_value","nargs","IteratorStream","iterator","t","next","isIteratorLike","_iterator","done","StridedArrayStream","N","stride","_N","_buffer","JoinStream","_encoding","_init","RegExp","isRegExp","decode","enc","SplitStream","splits","_index","stderr","stdin","stdout","transform","flush","destroy","require$$1","TransformStream","_transform","_flush","copts","streams","debugStream","debugSinkStream","emptyStream","arrayStream","circularArrayStream","constantStream","iteratorStream","stridedArrayStream","inspectStream","inspectSinkStream","joinStream","splitStream","transformStream"],"mappings":";6WAsBA,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,IAC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GAyDbhJ,GAAS+I,EAAiB9H,IAa1B8H,EAAgBhX,UAAUiX,WAAaL,EAElCO,EAAMN,QAUVG,EAAgBhX,UAAUkX,OAASC,EAAMN,OAa1CG,EAAgBhX,UAAU8W,QAAUA,GAE7BE,CACR,II5JI,IAAAI,GAAU,CAAG,SAUjBrR,EAAaqR,GAAS,cAAeC,IAUrCtR,EAAaqR,GAAS,kBAAmBE,IAUzCvR,EAAaqR,GAAS,cAAeG,IAUrCxR,EAAaqR,GAAS,cAAeI,IAUrCzR,EAAaqR,GAAS,sBAAuBK,IAU7C1R,EAAaqR,GAAS,iBAAkBM,IAUxC3R,EAAaqR,GAAS,iBAAkBO,IAUxC5R,EAAaqR,GAAS,qBAAsBQ,IAU5C7R,EAAaqR,GAAS,gBAAiBS,IAUvC9R,EAAaqR,GAAS,oBAAqBU,IAU3C/R,EAAaqR,GAAS,aAAcW,IAUpChS,EAAaqR,GAAS,cAAeY,IAUrCjS,EAAaqR,GAAS,SAAUX,IAUhC1Q,EAAaqR,GAAS,QAASV,IAU/B3Q,EAAaqR,GAAS,SAAUT,IAUhC5Q,EAAaqR,GAAS,kBAAmBa","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,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,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267]} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index eb5b6e9..0000000 --- a/lib/index.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'; - -/* -* 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 streams -*/ -var streams = {}; - -/** -* @name debugStream -* @memberof streams -* @readonly -* @type {Function} -* @see {@link module:@stdlib/streams/node/debug} -*/ -setReadOnly( streams, 'debugStream', require( '@stdlib/streams-node-debug' ) ); - -/** -* @name debugSinkStream -* @memberof streams -* @readonly -* @type {Function} -* @see {@link module:@stdlib/streams/node/debug-sink} -*/ -setReadOnly( streams, 'debugSinkStream', require( '@stdlib/streams-node-debug-sink' ) ); - -/** -* @name emptyStream -* @memberof streams -* @readonly -* @type {Function} -* @see {@link module:@stdlib/streams/node/empty} -*/ -setReadOnly( streams, 'emptyStream', require( '@stdlib/streams-node-empty' ) ); - -/** -* @name arrayStream -* @memberof streams -* @readonly -* @type {Function} -* @see {@link module:@stdlib/streams/node/from-array} -*/ -setReadOnly( streams, 'arrayStream', require( '@stdlib/streams-node-from-array' ) ); - -/** -* @name circularArrayStream -* @memberof streams -* @readonly -* @type {Function} -* @see {@link module:@stdlib/streams/node/from-circular-array} -*/ -setReadOnly( streams, 'circularArrayStream', require( '@stdlib/streams-node-from-circular-array' ) ); - -/** -* @name constantStream -* @memberof streams -* @readonly -* @type {Function} -* @see {@link module:@stdlib/streams/node/from-constant} -*/ -setReadOnly( streams, 'constantStream', require( '@stdlib/streams-node-from-constant' ) ); - -/** -* @name iteratorStream -* @memberof streams -* @readonly -* @type {Function} -* @see {@link module:@stdlib/streams/node/from-iterator} -*/ -setReadOnly( streams, 'iteratorStream', require( '@stdlib/streams-node-from-iterator' ) ); - -/** -* @name stridedArrayStream -* @memberof streams -* @readonly -* @type {Function} -* @see {@link module:@stdlib/streams/node/from-strided-array} -*/ -setReadOnly( streams, 'stridedArrayStream', require( '@stdlib/streams-node-from-strided-array' ) ); - -/** -* @name inspectStream -* @memberof streams -* @readonly -* @type {Function} -* @see {@link module:@stdlib/streams/node/inspect} -*/ -setReadOnly( streams, 'inspectStream', require( '@stdlib/streams-node-inspect' ) ); - -/** -* @name inspectSinkStream -* @memberof streams -* @readonly -* @type {Function} -* @see {@link module:@stdlib/streams/node/inspect-sink} -*/ -setReadOnly( streams, 'inspectSinkStream', require( '@stdlib/streams-node-inspect-sink' ) ); - -/** -* @name joinStream -* @memberof streams -* @readonly -* @type {Function} -* @see {@link module:@stdlib/streams/node/join} -*/ -setReadOnly( streams, 'joinStream', require( '@stdlib/streams-node-join' ) ); - -/** -* @name splitStream -* @memberof streams -* @readonly -* @type {Function} -* @see {@link module:@stdlib/streams/node/split} -*/ -setReadOnly( streams, 'splitStream', require( '@stdlib/streams-node-split' ) ); - -/** -* @name stderr -* @memberof streams -* @readonly -* @type {Function} -* @see {@link module:@stdlib/streams/node/stderr} -*/ -setReadOnly( streams, 'stderr', require( '@stdlib/streams-node-stderr' ) ); - -/** -* @name stdin -* @memberof streams -* @readonly -* @type {Function} -* @see {@link module:@stdlib/streams/node/stdin} -*/ -setReadOnly( streams, 'stdin', require( '@stdlib/streams-node-stdin' ) ); - -/** -* @name stdout -* @memberof streams -* @readonly -* @type {Function} -* @see {@link module:@stdlib/streams/node/stdout} -*/ -setReadOnly( streams, 'stdout', require( '@stdlib/streams-node-stdout' ) ); - -/** -* @name transformStream -* @memberof streams -* @readonly -* @type {Function} -* @see {@link module:@stdlib/streams/node/transform} -*/ -setReadOnly( streams, 'transformStream', require( '@stdlib/streams-node-transform' ) ); - - -// EXPORTS // - -module.exports = streams; diff --git a/package.json b/package.json index 245f311..7299ea8 100644 --- a/package.json +++ b/package.json @@ -3,30 +3,7 @@ "version": "0.2.2", "description": "Node.js streams.", "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,83 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/streams-node-debug": "^0.2.2", - "@stdlib/streams-node-debug-sink": "^0.2.2", - "@stdlib/streams-node-empty": "^0.2.2", - "@stdlib/streams-node-from-array": "^0.2.2", - "@stdlib/streams-node-from-circular-array": "^0.2.2", - "@stdlib/streams-node-from-constant": "^0.2.2", - "@stdlib/streams-node-from-iterator": "^0.2.2", - "@stdlib/streams-node-from-strided-array": "^0.2.2", - "@stdlib/streams-node-inspect": "^0.2.2", - "@stdlib/streams-node-inspect-sink": "^0.2.2", - "@stdlib/streams-node-join": "^0.2.2", - "@stdlib/streams-node-split": "^0.2.2", - "@stdlib/streams-node-stderr": "^0.2.2", - "@stdlib/streams-node-stdin": "^0.2.2", - "@stdlib/streams-node-stdout": "^0.2.2", - "@stdlib/streams-node-transform": "^0.2.2", - "@stdlib/utils-define-read-only-property": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-float64": "^0.2.2", - "@stdlib/array-to-iterator": "^0.2.2", - "@stdlib/array-uint8": "^0.2.2", - "@stdlib/assert-has-own-property": "^0.2.2", - "@stdlib/assert-is-boolean": "^0.2.2", - "@stdlib/assert-is-browser": "^0.2.2", - "@stdlib/assert-is-buffer": "^0.2.2", - "@stdlib/assert-is-collection": "^0.2.2", - "@stdlib/assert-is-error": "^0.2.2", - "@stdlib/assert-is-function": "^0.2.2", - "@stdlib/assert-is-integer": "^0.2.2", - "@stdlib/assert-is-iterator-like": "^0.2.2", - "@stdlib/assert-is-nonnegative-integer": "^0.2.2", - "@stdlib/assert-is-nonnegative-number": "^0.2.2", - "@stdlib/assert-is-plain-object": "^0.2.2", - "@stdlib/assert-is-regexp": "^0.2.2", - "@stdlib/assert-is-string": "^0.2.2", - "@stdlib/assert-is-uint8array": "^0.2.2", - "@stdlib/assert-is-windows": "^0.2.2", - "@stdlib/blas-base-gcopy": "^0.2.1", - "@stdlib/buffer-ctor": "^0.2.2", - "@stdlib/buffer-from-arraybuffer": "^0.2.2", - "@stdlib/buffer-from-string": "^0.2.2", - "@stdlib/fs-read-file": "^0.2.2", - "@stdlib/object-assign": "^0.2.2", - "@stdlib/process-exec-path": "^0.2.2", - "@stdlib/random-base-randu": "^0.2.1", - "@stdlib/random-iter-randu": "^0.2.1", - "@stdlib/string-format": "^0.2.2", - "@stdlib/utils-define-nonenumerable-property": "^0.2.2", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", - "@stdlib/utils-inherit": "^0.2.2", - "@stdlib/utils-keys": "^0.2.2", - "@stdlib/utils-next-tick": "^0.2.2", - "@stdlib/utils-noop": "^0.2.2", - "@stdlib/utils-parse-json": "^0.2.2", - "proxyquire": "^2.0.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "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/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..d19aa0b --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..884abd0 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index eab55c2..0000000 --- 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 streams = require( './../lib' ); - - -// TESTS // - -tape( 'main export is an object', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof streams, 'object', 'main export is an object' ); - t.end(); -}); - -tape( 'the exported object contains streams', function test( t ) { - var keys = objectKeys( streams ); - t.equal( keys.length > 0, true, 'has keys' ); - t.end(); -});