diff --git a/.editorconfig b/.editorconfig
deleted file mode 100644
index 60d743f..0000000
--- a/.editorconfig
+++ /dev/null
@@ -1,181 +0,0 @@
-#/
-# @license Apache-2.0
-#
-# Copyright (c) 2017 The Stdlib Authors.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#/
-
-# EditorConfig configuration file (see ).
-
-# Indicate that this file is a root-level configuration file:
-root = true
-
-# Set properties for all files:
-[*]
-end_of_line = lf
-charset = utf-8
-trim_trailing_whitespace = true
-insert_final_newline = true
-
-# Set properties for JavaScript files:
-[*.{js,js.txt}]
-indent_style = tab
-
-# Set properties for JavaScript ES module files:
-[*.{mjs,mjs.txt}]
-indent_style = tab
-
-# Set properties for JavaScript CommonJS files:
-[*.{cjs,cjs.txt}]
-indent_style = tab
-
-# Set properties for JSON files:
-[*.{json,json.txt}]
-indent_style = space
-indent_size = 2
-
-# Set properties for `cli_opts.json` files:
-[cli_opts.json]
-indent_style = tab
-
-# Set properties for TypeScript files:
-[*.ts]
-indent_style = tab
-
-# Set properties for Python files:
-[*.{py,py.txt}]
-indent_style = space
-indent_size = 4
-
-# Set properties for Julia files:
-[*.{jl,jl.txt}]
-indent_style = tab
-
-# Set properties for R files:
-[*.{R,R.txt}]
-indent_style = tab
-
-# Set properties for C files:
-[*.{c,c.txt}]
-indent_style = tab
-
-# Set properties for C header files:
-[*.{h,h.txt}]
-indent_style = tab
-
-# Set properties for C++ files:
-[*.{cpp,cpp.txt}]
-indent_style = tab
-
-# Set properties for C++ header files:
-[*.{hpp,hpp.txt}]
-indent_style = tab
-
-# Set properties for Fortran files:
-[*.{f,f.txt}]
-indent_style = space
-indent_size = 2
-insert_final_newline = false
-
-# Set properties for shell files:
-[*.{sh,sh.txt}]
-indent_style = tab
-
-# Set properties for AWK files:
-[*.{awk,awk.txt}]
-indent_style = tab
-
-# Set properties for HTML files:
-[*.{html,html.txt}]
-indent_style = tab
-tab_width = 2
-
-# Set properties for XML files:
-[*.{xml,xml.txt}]
-indent_style = tab
-tab_width = 2
-
-# Set properties for CSS files:
-[*.{css,css.txt}]
-indent_style = tab
-
-# Set properties for Makefiles:
-[Makefile]
-indent_style = tab
-
-[*.{mk,mk.txt}]
-indent_style = tab
-
-# Set properties for Markdown files:
-[*.{md,md.txt}]
-indent_style = space
-indent_size = 4
-trim_trailing_whitespace = false
-
-# Set properties for `usage.txt` files:
-[usage.txt]
-indent_style = space
-indent_size = 2
-
-# Set properties for `repl.txt` files:
-[repl.txt]
-indent_style = space
-indent_size = 4
-
-# Set properties for `package.json` files:
-[package.{json,json.txt}]
-indent_style = space
-indent_size = 2
-
-# Set properties for `datapackage.json` files:
-[datapackage.json]
-indent_style = space
-indent_size = 2
-
-# Set properties for `manifest.json` files:
-[manifest.json]
-indent_style = space
-indent_size = 2
-
-# Set properties for `tsconfig.json` files:
-[tsconfig.json]
-indent_style = space
-indent_size = 2
-
-# Set properties for LaTeX files:
-[*.{tex,tex.txt}]
-indent_style = tab
-
-# Set properties for LaTeX Bibliography files:
-[*.{bib,bib.txt}]
-indent_style = tab
-
-# Set properties for YAML files:
-[*.{yml,yml.txt}]
-indent_style = space
-indent_size = 2
-
-# Set properties for GYP files:
-[binding.gyp]
-indent_style = space
-indent_size = 2
-
-[*.gypi]
-indent_style = space
-indent_size = 2
-
-# Set properties for citation files:
-[*.{cff,cff.txt}]
-indent_style = space
-indent_size = 2
diff --git a/.eslintrc.js b/.eslintrc.js
deleted file mode 100644
index 5f30286..0000000
--- a/.eslintrc.js
+++ /dev/null
@@ -1 +0,0 @@
-/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */
diff --git a/.gitattributes b/.gitattributes
deleted file mode 100644
index 1c88e69..0000000
--- a/.gitattributes
+++ /dev/null
@@ -1,66 +0,0 @@
-#/
-# @license Apache-2.0
-#
-# Copyright (c) 2017 The Stdlib Authors.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#/
-
-# Configuration file which assigns attributes to pathnames.
-#
-# [1]: https://git-scm.com/docs/gitattributes
-
-# Automatically normalize the line endings of any committed text files:
-* text=auto
-
-# Override line endings for certain files on checkout:
-*.crlf.csv text eol=crlf
-
-# Denote that certain files are binary and should not be modified:
-*.png binary
-*.jpg binary
-*.jpeg binary
-*.gif binary
-*.ico binary
-*.gz binary
-*.zip binary
-*.7z binary
-*.mp3 binary
-*.mp4 binary
-*.mov binary
-
-# Override what is considered "vendored" by GitHub's linguist:
-/lib/node_modules/** -linguist-vendored -linguist-generated
-
-# Configure directories which should *not* be included in GitHub language statistics:
-/deps/** linguist-vendored
-/dist/** linguist-generated
-/workshops/** linguist-vendored
-
-benchmark/** linguist-vendored
-docs/* linguist-documentation
-etc/** linguist-vendored
-examples/** linguist-documentation
-scripts/** linguist-vendored
-test/** linguist-vendored
-tools/** linguist-vendored
-
-# Configure files which should *not* be included in GitHub language statistics:
-Makefile linguist-vendored
-*.mk linguist-vendored
-*.jl linguist-vendored
-*.py linguist-vendored
-*.R linguist-vendored
-
-# Configure files which should be included in GitHub language statistics:
-docs/types/*.d.ts -linguist-documentation
diff --git a/.github/.keepalive b/.github/.keepalive
deleted file mode 100644
index f54f645..0000000
--- a/.github/.keepalive
+++ /dev/null
@@ -1 +0,0 @@
-2024-12-01T03:59:26.910Z
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
deleted file mode 100644
index bbd2e19..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/utils/async) 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 843c9f4..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/utils/async) 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 1fe38f1..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: '0 12 * * 6'
-
- # 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 ns = require( '@stdlib/utils-async' );
+If no recognized module system is present, access bundle contents via the global scope:
+
+```html
+
```
#### ns
@@ -125,11 +131,21 @@ var o = ns;
-```javascript
-var objectKeys = require( '@stdlib/utils-keys' );
-var ns = require( '@stdlib/utils-async' );
+```html
+
+
+
+
+
+
+
+
```
@@ -218,69 +234,69 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
-[@stdlib/utils/async/any-by-right]: https://github.com/stdlib-js/utils-async-any-by-right
+[@stdlib/utils/async/any-by-right]: https://github.com/stdlib-js/utils-async-any-by-right/tree/umd
-[@stdlib/utils/async/any-by]: https://github.com/stdlib-js/utils-async-any-by
+[@stdlib/utils/async/any-by]: https://github.com/stdlib-js/utils-async-any-by/tree/umd
-[@stdlib/utils/async/bifurcate-by]: https://github.com/stdlib-js/utils-async-bifurcate-by
+[@stdlib/utils/async/bifurcate-by]: https://github.com/stdlib-js/utils-async-bifurcate-by/tree/umd
-[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose
+[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/umd
-[@stdlib/utils/async/count-by]: https://github.com/stdlib-js/utils-async-count-by
+[@stdlib/utils/async/count-by]: https://github.com/stdlib-js/utils-async-count-by/tree/umd
-[@stdlib/utils/async/do-until]: https://github.com/stdlib-js/utils-async-do-until
+[@stdlib/utils/async/do-until]: https://github.com/stdlib-js/utils-async-do-until/tree/umd
-[@stdlib/utils/async/do-while]: https://github.com/stdlib-js/utils-async-do-while
+[@stdlib/utils/async/do-while]: https://github.com/stdlib-js/utils-async-do-while/tree/umd
-[@stdlib/utils/async/every-by-right]: https://github.com/stdlib-js/utils-async-every-by-right
+[@stdlib/utils/async/every-by-right]: https://github.com/stdlib-js/utils-async-every-by-right/tree/umd
-[@stdlib/utils/async/every-by]: https://github.com/stdlib-js/utils-async-every-by
+[@stdlib/utils/async/every-by]: https://github.com/stdlib-js/utils-async-every-by/tree/umd
-[@stdlib/utils/async/for-each-right]: https://github.com/stdlib-js/utils-async-for-each-right
+[@stdlib/utils/async/for-each-right]: https://github.com/stdlib-js/utils-async-for-each-right/tree/umd
-[@stdlib/utils/async/for-each]: https://github.com/stdlib-js/utils-async-for-each
+[@stdlib/utils/async/for-each]: https://github.com/stdlib-js/utils-async-for-each/tree/umd
-[@stdlib/utils/async/function-sequence]: https://github.com/stdlib-js/utils-async-function-sequence
+[@stdlib/utils/async/function-sequence]: https://github.com/stdlib-js/utils-async-function-sequence/tree/umd
-[@stdlib/utils/async/group-by]: https://github.com/stdlib-js/utils-async-group-by
+[@stdlib/utils/async/group-by]: https://github.com/stdlib-js/utils-async-group-by/tree/umd
-[@stdlib/utils/async/if-else]: https://github.com/stdlib-js/utils-async-if-else
+[@stdlib/utils/async/if-else]: https://github.com/stdlib-js/utils-async-if-else/tree/umd
-[@stdlib/utils/async/if-then]: https://github.com/stdlib-js/utils-async-if-then
+[@stdlib/utils/async/if-then]: https://github.com/stdlib-js/utils-async-if-then/tree/umd
-[@stdlib/utils/async/inmap-right]: https://github.com/stdlib-js/utils-async-inmap-right
+[@stdlib/utils/async/inmap-right]: https://github.com/stdlib-js/utils-async-inmap-right/tree/umd
-[@stdlib/utils/async/inmap]: https://github.com/stdlib-js/utils-async-inmap
+[@stdlib/utils/async/inmap]: https://github.com/stdlib-js/utils-async-inmap/tree/umd
-[@stdlib/utils/async/map-function]: https://github.com/stdlib-js/utils-async-map-function
+[@stdlib/utils/async/map-function]: https://github.com/stdlib-js/utils-async-map-function/tree/umd
-[@stdlib/utils/async/map-keys]: https://github.com/stdlib-js/utils-async-map-keys
+[@stdlib/utils/async/map-keys]: https://github.com/stdlib-js/utils-async-map-keys/tree/umd
-[@stdlib/utils/async/map-values]: https://github.com/stdlib-js/utils-async-map-values
+[@stdlib/utils/async/map-values]: https://github.com/stdlib-js/utils-async-map-values/tree/umd
-[@stdlib/utils/async/none-by-right]: https://github.com/stdlib-js/utils-async-none-by-right
+[@stdlib/utils/async/none-by-right]: https://github.com/stdlib-js/utils-async-none-by-right/tree/umd
-[@stdlib/utils/async/none-by]: https://github.com/stdlib-js/utils-async-none-by
+[@stdlib/utils/async/none-by]: https://github.com/stdlib-js/utils-async-none-by/tree/umd
-[@stdlib/utils/async/reduce-right]: https://github.com/stdlib-js/utils-async-reduce-right
+[@stdlib/utils/async/reduce-right]: https://github.com/stdlib-js/utils-async-reduce-right/tree/umd
-[@stdlib/utils/async/reduce]: https://github.com/stdlib-js/utils-async-reduce
+[@stdlib/utils/async/reduce]: https://github.com/stdlib-js/utils-async-reduce/tree/umd
-[@stdlib/utils/async/series-waterfall]: https://github.com/stdlib-js/utils-async-series-waterfall
+[@stdlib/utils/async/series-waterfall]: https://github.com/stdlib-js/utils-async-series-waterfall/tree/umd
-[@stdlib/utils/async/some-by-right]: https://github.com/stdlib-js/utils-async-some-by-right
+[@stdlib/utils/async/some-by-right]: https://github.com/stdlib-js/utils-async-some-by-right/tree/umd
-[@stdlib/utils/async/some-by]: https://github.com/stdlib-js/utils-async-some-by
+[@stdlib/utils/async/some-by]: https://github.com/stdlib-js/utils-async-some-by/tree/umd
-[@stdlib/utils/async/tabulate-by]: https://github.com/stdlib-js/utils-async-tabulate-by
+[@stdlib/utils/async/tabulate-by]: https://github.com/stdlib-js/utils-async-tabulate-by/tree/umd
-[@stdlib/utils/async/try-catch]: https://github.com/stdlib-js/utils-async-try-catch
+[@stdlib/utils/async/try-catch]: https://github.com/stdlib-js/utils-async-try-catch/tree/umd
-[@stdlib/utils/async/try-then]: https://github.com/stdlib-js/utils-async-try-then
+[@stdlib/utils/async/try-then]: https://github.com/stdlib-js/utils-async-try-then/tree/umd
-[@stdlib/utils/async/until]: https://github.com/stdlib-js/utils-async-until
+[@stdlib/utils/async/until]: https://github.com/stdlib-js/utils-async-until/tree/umd
-[@stdlib/utils/async/while]: https://github.com/stdlib-js/utils-async-while
+[@stdlib/utils/async/while]: https://github.com/stdlib-js/utils-async-while/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 461efb0..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/utils/async"
-%% click B href "https://github.com/stdlib-js/utils-async/tree/main"
-%% click C href "https://github.com/stdlib-js/utils-async/tree/production"
-%% click D href "https://github.com/stdlib-js/utils-async/tree/esm"
-%% click E href "https://github.com/stdlib-js/utils-async/tree/deno"
-%% click F href "https://github.com/stdlib-js/utils-async/tree/umd"
-```
-
-[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/async
-[production-url]: https://github.com/stdlib-js/utils-async/tree/production
-[deno-url]: https://github.com/stdlib-js/utils-async/tree/deno
-[deno-readme]: https://github.com/stdlib-js/utils-async/blob/deno/README.md
-[umd-url]: https://github.com/stdlib-js/utils-async/tree/umd
-[umd-readme]: https://github.com/stdlib-js/utils-async/blob/umd/README.md
-[esm-url]: https://github.com/stdlib-js/utils-async/tree/esm
-[esm-readme]: https://github.com/stdlib-js/utils-async/blob/esm/README.md
\ No newline at end of file
diff --git a/browser.js b/browser.js
new file mode 100644
index 0000000..eba1b32
--- /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
+var e,n;e=this,n=function(){"use strict";var e="function"==typeof Object.defineProperty?Object.defineProperty:null,n=Object.defineProperty;function t(e){return"number"==typeof e}function i(e){var n,t="";for(n=0;n0&&(n-=1),i=r.toExponential(n)):i=r.toPrecision(e.precision),e.alternate||(i=f.call(i,v,"$1e"),i=f.call(i,y,"e"),i=f.call(i,d,""));break;default:throw new Error("invalid double notation. Value: "+e.specifier)}return i=f.call(i,m,"e+0$1"),i=f.call(i,g,"e-0$1"),e.alternate&&(i=f.call(i,p,"$1."),i=f.call(i,h,"$1.e")),r>=0&&e.sign&&(i=e.sign+i),i=e.specifier===c.call(e.specifier)?c.call(i):a.call(i)}function w(e){var n,t="";for(n=0;n127)throw new Error("invalid character code. Value: "+i.arg);i.arg=A(l)?String(i.arg):E(l)}break;case"e":case"E":case"f":case"F":case"g":case"G":n||(i.precision=6),i.arg=b(i);break;default:throw new Error("invalid specifier: "+i.specifier)}i.maxWidth>=0&&i.arg.length>i.maxWidth&&(i.arg=i.arg.substring(0,i.maxWidth)),i.padZeros?i.arg=r(i.arg,i.width||i.precision,i.padRight):i.width&&(i.arg=(m=i.arg,g=i.width,p=i.padRight,h=void 0,(h=g-m.length)<0?m:m=p?m+w(h):w(h)+m)),u+=i.arg||"",a+=1}return u}var F=/%(?:([1-9]\d*)\$)?([0 +\-#]*)(\*|\d+)?(?:(\.)(\*|\d+)?)?[hlL]?([%A-Za-z])/g;function j(e){var n={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]&&(n.precision="1"),n}function C(e){var n,t,i,r;for(t=[],r=0,i=F.exec(e);i;)(n=e.slice(r,F.lastIndex-i[0].length)).length&&t.push(n),t.push(j(i)),r=F.lastIndex,i=F.exec(e);return(n=e.slice(r)).length&&t.push(n),t}function S(e){var n,t;if("string"!=typeof e)throw new TypeError(S("invalid argument. First argument must be a string. Value: `%s`.",e));for(n=[C(e)],t=1;t=0&&e.length<=de}var ve,be=Number.POSITIVE_INFINITY,we=Object,Ee=Object.getPrototypeOf;ve=ge(Object.getPrototypeOf)?Ee:function(e){var n=function(e){return e.__proto__}(e);return n||null===n?n:"[object Function]"===z(e.constructor)?e.constructor.prototype:e instanceof Object?Object.prototype:null};var Te=ve,Ae=Object.prototype;function Oe(e){var n;return!!function(e){return"object"==typeof e&&null!==e&&!ae(e)}(e)&&(n=function(e){return null==e?null:(e=we(e),Te(e))}(e),!n||!U(e,"constructor")&&U(n,"constructor")&&ge(n.constructor)&&"[object Function]"===z(n.constructor)&&U(n,"isPrototypeOf")&&ge(n.isPrototypeOf)&&(n===Ae||function(e){var n;for(n in e)if(!U(e,n))return!1;return!0}(e)))}function Ve(e){return"number"==typeof e}var Fe=Number,je=Fe.prototype.toString,Ce=G();function Se(e){return"object"==typeof e&&(e instanceof Fe||(Ce?function(e){try{return je.call(e),!0}catch(e){return!1}}(e):"[object Number]"===z(e)))}function Ne(e){return Ve(e)||Se(e)}R(Ne,"isPrimitive",Ve),R(Ne,"isObject",Se);var Le=Fe.NEGATIVE_INFINITY;function Pe(e){return eLe&&he(e)}function _e(e){return Ve(e)&&Pe(e)}function ke(e){return Se(e)&&Pe(e.valueOf())}function xe(e){return _e(e)||ke(e)}function Je(e){return _e(e)&&e>0}function Ie(e){return ke(e)&&e.valueOf()>0}function Be(e){return Je(e)||Ie(e)}function Re(e){if(e.__esModule)return e;var n=e.default;if("function"==typeof n){var t=function e(){return this instanceof e?Reflect.construct(n,arguments,this.constructor):n.apply(this,arguments)};t.prototype=n.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(e).forEach((function(n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})})),t}R(xe,"isPrimitive",_e),R(xe,"isObject",ke),R(Be,"isPrimitive",Je),R(Be,"isObject",Ie);var $e=Re(Object.freeze({__proto__:null,default:()=>()=>{}})),Me=$e("any-by-async:limit");function We(e,n){var t,i,r;if(t={},arguments.length>1){if(i=function(e,n){return Oe(n)?(U(n,"thisArg")&&(e.thisArg=n.thisArg),U(n,"series")&&(e.series=n.series,!M(e.series))?new TypeError(S("invalid option. `%s` option must be a boolean. Option: `%s`.","series",e.series)):U(n,"limit")&&(e.limit=n.limit,!Je(e.limit))?new TypeError(S("invalid option. `%s` option must be a positive integer. Option: `%s`.","limit",e.limit)):null):new TypeError(S("invalid argument. Options argument must be an object. Value: `%s`.",n))}(t,e),i)throw i;r=n}else r=e;if(!ge(r))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",r));return t.series?t.limit=1:t.limit||(t.limit=be),function(e,n){if(!ye(e))throw new TypeError(S("invalid argument. First argument must be a collection. Value: `%s`.",e));if(!ge(n))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",n));return function(e,n,t,i){var r,o,l,s,u,a,c;if(u=e.length,Me("Collection length: %d",u),0===u)return Me("Finished processing a collection."),i(null,!1);for(s=u1){if(i=function(e,n){return Oe(n)?(U(n,"thisArg")&&(e.thisArg=n.thisArg),U(n,"series")&&(e.series=n.series,!M(e.series))?new TypeError(S("invalid option. `%s` option must be a boolean. Option: `%s`.","series",e.series)):U(n,"limit")&&(e.limit=n.limit,!Je(e.limit))?new TypeError(S("invalid option. `%s` option must be a positive integer. Option: `%s`.","limit",e.limit)):null):new TypeError(S("invalid argument. Options argument must be an object. Value: `%s`.",n))}(t,e),i)throw i;r=n}else r=e;if(!ge(r))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",r));return t.series?t.limit=1:t.limit||(t.limit=be),function(e,n){if(!ye(e))throw new TypeError(S("invalid argument. First argument must be a collection. Value: `%s`.",e));if(!ge(n))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",n));return function(e,n,t,i){var r,o,l,s,u,a;if(s=e.length,Xe("Collection length: %d",s),0===s)return Xe("Finished processing a collection."),i(null,!1);for(l=s0&&c();function c(){Xe("Collection element %d: %s.",u-=1,JSON.stringify(e[u])),2===t.length?t.call(n.thisArg,e[u],f):3===t.length?t.call(n.thisArg,e[u],u,f):t.call(n.thisArg,e[u],u,e,f)}function f(e,n){if(!o)return e?(o=!0,Xe("Encountered an error: %s",e.message),i(e)):(Xe("Processed %d of %d collection elements.",r+=1,s),Xe("Test result: %s",!!n),n&&!o?(o=!0,Xe("Finished processing a collection."),i(null,!0)):u>0?c():r===s?(Xe("Finished processing a collection."),i(null,!1)):void 0)}}(e,t,r,(function(e,t){if(e)return n(e,!1);n(null,t)}))}}function Ue(e,n,t,i){if(arguments.length<4)return Ze(n)(e,t);Ze(n,t)(e,i)}function Ye(e){return e!=e}function qe(e){return Ve(e)&&Ye(e)}function ze(e){return Se(e)&&Ye(e.valueOf())}function De(e){return qe(e)||ze(e)}function He(e){return"string"==typeof e}R(Ue,"factory",Ze),R(De,"isPrimitive",qe),R(De,"isObject",ze);var Ke=String.prototype.valueOf,Qe=G();function en(e){return"object"==typeof e&&(e instanceof String||(Qe?function(e){try{return Ke.call(e),!0}catch(e){return!1}}(e):"[object String]"===z(e)))}function nn(e){return He(e)||en(e)}function tn(e,n,t){var i,r;if(!ye(e)&&!He(e))throw new TypeError(S("invalid argument. First argument must be an array-like object. Value: `%s`.",e));if(0===(i=e.length))return-1;if(3===arguments.length){if(!_e(t))throw new TypeError(S("invalid argument. Third argument must be an integer. Value: `%s`.",t));if(t>=0){if(t>=i)return-1;r=t}else(r=i+t)<0&&(r=0)}else r=0;if(De(n)){for(;r1){if(i=function(e,n){return Oe(n)?(U(n,"thisArg")&&(e.thisArg=n.thisArg),U(n,"series")&&(e.series=n.series,!M(e.series))?new TypeError(S("invalid option. `%s` option must be a boolean. Option: `%s`.","series",e.series)):U(n,"limit")&&(e.limit=n.limit,!Je(e.limit))?new TypeError(S("invalid option. `%s` option must be a positive integer. Option: `%s`.","limit",e.limit)):U(n,"returns")&&(e.returns=n.returns,-1===tn(rn,e.returns))?new TypeError(S('invalid option. `%s` option must be one of the following: "%s". Option: `%s`.',"returns",rn.join('", "'),e.returns)):null):new TypeError(S("invalid argument. Options argument must be an object. Value: `%s`.",n))}(t,e),i)throw i;r=n}else r=e;if(!ge(r))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",r));return t.series?t.limit=1:t.limit||(t.limit=be),function(e,n){if(!ye(e))throw new TypeError(S("invalid argument. First argument must be a collection. Value: `%s`.",e));if(!ge(n))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",n));return function(e,n,t,i){var r,o,l,s,u,a,c,f;if(u=e.length,on("Collection length: %d",u),c=[],0===u)return on("Finished processing a collection."),i(null,c);for(c.push([],[]),s=u1){if(i=function(e,n){return Oe(n)?(U(n,"thisArg")&&(e.thisArg=n.thisArg),U(n,"series")&&(e.series=n.series,!M(e.series))?new TypeError(S("invalid option. `%s` option must be a boolean. Option: `%s`.","series",e.series)):U(n,"limit")&&(e.limit=n.limit,!Je(e.limit))?new TypeError(S("invalid option. `%s` option must be a positive integer. Option: `%s`.","limit",e.limit)):null):new TypeError(S("invalid argument. Options argument must be an object. Value: `%s`.",n))}(t,e),i)throw i;r=n}else r=e;if(!ge(r))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",r));return t.series?t.limit=1:t.limit||(t.limit=be),function(e,n){if(!ye(e))throw new TypeError(S("invalid argument. First argument must be a collection. Value: `%s`.",e));if(!ge(n))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",n));return function(e,n,t,i){var r,o,l,s,u,a,c,f;if(u=e.length,un("Collection length: %d",u),c={},0===u)return un("Finished processing a collection."),i(null,c);for(s=u1){if(i=function(e,n){return Oe(n)?(U(n,"thisArg")&&(e.thisArg=n.thisArg),U(n,"series")&&(e.series=n.series,!M(e.series))?new TypeError(S("invalid option. `%s` option must be a boolean. Option: `%s`.","series",e.series)):U(n,"limit")&&(e.limit=n.limit,!Je(e.limit))?new TypeError(S("invalid option. `%s` option must be a positive integer. Option: `%s`.","limit",e.limit)):null):new TypeError(S("invalid argument. Options argument must be an object. Value: `%s`.",n))}(t,e),i)throw i;r=n}else r=e;if(!ge(r))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",r));return t.series?t.limit=1:t.limit||(t.limit=be),function(e,n){if(!ye(e))throw new TypeError(S("invalid argument. First argument must be a collection. Value: `%s`.",e));if(!ge(n))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",n));return function(e,n,t,i){var r,o,l,s,u,a,c;if(u=e.length,fn("Collection length: %d",u),0===u)return fn("Finished processing a collection."),i(null,!0);for(s=u1){if(i=function(e,n){return Oe(n)?(U(n,"thisArg")&&(e.thisArg=n.thisArg),U(n,"series")&&(e.series=n.series,!M(e.series))?new TypeError(S("invalid option. `%s` option must be a boolean. Option: `%s`.","series",e.series)):U(n,"limit")&&(e.limit=n.limit,!Je(e.limit))?new TypeError(S("invalid option. `%s` option must be a positive integer. Option: `%s`.","limit",e.limit)):null):new TypeError(S("invalid argument. Options argument must be an object. Value: `%s`.",n))}(t,e),i)throw i;r=n}else r=e;if(!ge(r))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",r));return t.series?t.limit=1:t.limit||(t.limit=be),function(e,n){if(!ye(e))throw new TypeError(S("invalid argument. First argument must be a collection. Value: `%s`.",e));if(!ge(n))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",n));return function(e,n,t,i){var r,o,l,s,u,a;if(s=e.length,pn("Collection length: %d",s),0===s)return pn("Finished processing a collection."),i(null,!0);for(l=s0&&c();function c(){pn("Collection element %d: %s.",u-=1,JSON.stringify(e[u])),2===t.length?t.call(n.thisArg,e[u],f):3===t.length?t.call(n.thisArg,e[u],u,f):t.call(n.thisArg,e[u],u,e,f)}function f(e,n){if(!o)return e?(o=!0,pn("Encountered an error: %s",e.message),i(e)):(pn("Processed %d of %d collection elements.",r+=1,s),pn("Test result: %s",!!n),n||o?u>0?c():r===s?(pn("Finished processing a collection."),i(null,!0)):void 0:(o=!0,pn("Finished processing a collection."),i(null,!1)))}}(e,t,r,(function(e,t){if(e)return n(e,!1);n(null,t)}))}}function dn(e,n,t,i){if(arguments.length<4)return hn(n)(e,t);hn(n,t)(e,i)}R(dn,"factory",hn);var yn=$e("for-each-async:limit");function vn(e,n){var t,i,r;if(t={},arguments.length>1){if(i=function(e,n){return Oe(n)?(U(n,"thisArg")&&(e.thisArg=n.thisArg),U(n,"series")&&(e.series=n.series,!M(e.series))?new TypeError(S("invalid option. `%s` option must be a boolean. Option: `%s`.","series",e.series)):U(n,"limit")&&(e.limit=n.limit,!Je(e.limit))?new TypeError(S("invalid option. `%s` option must be a positive integer. Option: `%s`.","limit",e.limit)):null):new TypeError(S("invalid argument. Options argument must be an object. Value: `%s`.",n))}(t,e),i)throw i;r=n}else r=e;if(!ge(r))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",r));return t.series?t.limit=1:t.limit||(t.limit=be),function(e,n){if(!ye(e))throw new TypeError(S("invalid argument. First argument must be a collection. Value: `%s`.",e));if(!ge(n))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",n));return function(e,n,t,i){var r,o,l,s,u,a,c;if(u=e.length,yn("Collection length: %d",u),0===u)return yn("Finished processing a collection."),i();for(s=u1){if(i=function(e,n){return Oe(n)?(U(n,"thisArg")&&(e.thisArg=n.thisArg),U(n,"series")&&(e.series=n.series,!M(e.series))?new TypeError(S("invalid option. `%s` option must be a boolean. Option: `%s`.","series",e.series)):U(n,"limit")&&(e.limit=n.limit,!Je(e.limit))?new TypeError(S("invalid option. `%s` option must be a positive integer. Option: `%s`.","limit",e.limit)):null):new TypeError(S("invalid argument. Options argument must be an object. Value: `%s`.",n))}(t,e),i)throw i;r=n}else r=e;if(!ge(r))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",r));return t.series?t.limit=1:t.limit||(t.limit=be),function(e,n){if(!ye(e))throw new TypeError(S("invalid argument. First argument must be a collection. Value: `%s`.",e));if(!ge(n))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",n));return function(e,n,t,i){var r,o,l,s,u,a;if(s=e.length,wn("Collection length: %d",s),0===s)return wn("Finished processing a collection."),i();for(l=s0&&c();function c(){wn("Collection element %d: %s.",u-=1,JSON.stringify(e[u])),2===t.length?t.call(n.thisArg,e[u],f):3===t.length?t.call(n.thisArg,e[u],u,f):t.call(n.thisArg,e[u],u,e,f)}function f(e){if(!o)return e?(o=!0,wn("Encountered an error: %s",e.message),i(e)):(wn("Processed %d of %d collection elements.",r+=1,s),u>0?c():r===s?(wn("Finished processing a collection."),i()):void 0)}}(e,t,r,(function(e){if(e)return n(e);n()}))}}function Tn(e,n,t,i){if(arguments.length<4)return En(n)(e,t);En(n,t)(e,i)}R(Tn,"factory",En);var An=["values","indices","*"],On=$e("group-by-async:limit");function Vn(e,n){var t,i,r;if(t={},arguments.length>1){if(i=function(e,n){return Oe(n)?(U(n,"thisArg")&&(e.thisArg=n.thisArg),U(n,"series")&&(e.series=n.series,!M(e.series))?new TypeError(S("invalid option. `%s` option must be a boolean. Option: `%s`.","series",e.series)):U(n,"limit")&&(e.limit=n.limit,!Je(e.limit))?new TypeError(S("invalid option. `%s` option must be a positive integer. Option: `%s`.","limit",e.limit)):U(n,"returns")&&(e.returns=n.returns,-1===tn(An,e.returns))?new TypeError(S('invalid option. `%s` option must be one of the following: "%s". Option: `%s`.',"returns",An.join('", "'),e.returns)):null):new TypeError(S("invalid argument. Options argument must be an object. Value: `%s`.",n))}(t,e),i)throw i;r=n}else r=e;if(!ge(r))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",r));return t.series?t.limit=1:t.limit||(t.limit=be),function(e,n){if(!ye(e))throw new TypeError(S("invalid argument. First argument must be a collection. Value: `%s`.",e));if(!ge(n))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",n));return function(e,n,t,i){var r,o,l,s,u,a,c,f;if(u=e.length,On("Collection length: %d",u),c={},0===u)return On("Finished processing a collection."),i(null,c);for(s=u1){if(i=function(e,n){return Oe(n)?(U(n,"thisArg")&&(e.thisArg=n.thisArg),U(n,"series")&&(e.series=n.series,!M(e.series))?new TypeError(S("invalid option. `%s` option must be a boolean. Option: `%s`.","series",e.series)):U(n,"limit")&&(e.limit=n.limit,!Je(e.limit))?new TypeError(S("invalid option. `%s` option must be a positive integer. Option: `%s`.","limit",e.limit)):null):new TypeError(S("invalid argument. Options argument must be an object. Value: `%s`.",n))}(t,e),i)throw i;r=n}else r=e;if(!ge(r))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",r));return t.series?t.limit=1:t.limit||(t.limit=be),function(e,n){if(!ye(e))throw new TypeError(S("invalid argument. First argument must be a collection. Value: `%s`.",e));if(!ge(n))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",n));return function(e,n,t,i){var r,o,l,s,u,a,c;if(u=e.length,jn("Collection length: %d",u),0===u)return jn("Finished processing a collection."),i();for(s=u1){if(i=function(e,n){return Oe(n)?(U(n,"thisArg")&&(e.thisArg=n.thisArg),U(n,"series")&&(e.series=n.series,!M(e.series))?new TypeError(S("invalid option. `%s` option must be a boolean. Option: `%s`.","series",e.series)):U(n,"limit")&&(e.limit=n.limit,!Je(e.limit))?new TypeError(S("invalid option. `%s` option must be a positive integer. Option: `%s`.","limit",e.limit)):null):new TypeError(S("invalid argument. Options argument must be an object. Value: `%s`.",n))}(t,e),i)throw i;r=n}else r=e;if(!ge(r))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",r));return t.series?t.limit=1:t.limit||(t.limit=be),function(e,n){if(!ye(e))throw new TypeError(S("invalid argument. First argument must be a collection. Value: `%s`.",e));if(!ge(n))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",n));return function(e,n,t,i){var r,o,l,s,u,a;if(s=e.length,Nn("Collection length: %d",s),0===s)return Nn("Finished processing a collection."),i();for(l=s0&&c();function c(){var i;function r(n,t){if(!o){if(n)return o=!0,f(n);e[i]=t,f()}}Nn("Collection element %d: %s.",i=u-=1,JSON.stringify(e[i])),2===t.length?t.call(n.thisArg,e[i],r):3===t.length?t.call(n.thisArg,e[i],i,r):t.call(n.thisArg,e[i],i,e,r)}function f(e){return e?(Nn("Encountered an error: %s",e.message),i(e)):(Nn("Processed %d of %d collection elements.",r+=1,s),u>0?c():r===s?(Nn("Finished processing a collection."),i()):void 0)}}(e,t,r,(function(t){if(t)return n(t,e);n(null,e)}))}}function Pn(e,n,t,i){if(arguments.length<4)return Ln(n)(e,t);Ln(n,t)(e,i)}function _n(e){return _e(e)&&e>=0}function kn(e){return ke(e)&&e.valueOf()>=0}function xn(e){return _n(e)||kn(e)}R(Pn,"factory",Ln),R(xn,"isPrimitive",_n),R(xn,"isObject",kn);var Jn=$e("map-function-async:limit");function In(e,n){var t,i,r;if(t={},arguments.length>1){if(i=function(e,n){return Oe(n)?(U(n,"thisArg")&&(e.thisArg=n.thisArg),U(n,"series")&&(e.series=n.series,!M(e.series))?new TypeError(S("invalid option. `%s` option must be a boolean. Option: `%s`.","series",e.series)):U(n,"limit")&&(e.limit=n.limit,!Je(e.limit))?new TypeError(S("invalid option. `%s` option must be a positive integer. Option: `%s`.","limit",e.limit)):null):new TypeError(S("invalid argument. Options argument must be an object. Value: `%s`.",n))}(t,e),i)throw i;r=n}else r=e;if(!ge(r))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",r));return t.series?t.limit=1:t.limit||(t.limit=be),function(e,n){if(!_n(e))throw new TypeError(S("invalid argument. Number of function invocations must be a nonnegative integer. Value: `%s`.",e));if(!ge(n))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",n));return function(e,n,t,i){var r,o,l,s,u,a,c;if(Jn("Number of invocations: %d",e),l=new Array(e),0===e)return Jn("Finished invoking a function."),i(null,l);for(s=e=0&&n=0&&e.length<=4294967295&&U(e,"callee")&&!Un(e,"callee")},qn=Array.prototype.slice,zn=Un((function(){}),"prototype"),Dn=!Un({toString:null},"toString");function Hn(e){return e.constructor&&e.constructor.prototype===e}var Kn,Qn=["console","external","frame","frameElement","frames","innerHeight","innerWidth","outerHeight","outerWidth","pageXOffset","pageYOffset","parent","scrollLeft","scrollTop","scrollX","scrollY","self","webkitIndexedDB","webkitStorageInfo","window"],et="undefined"==typeof window?void 0:window,nt=function(){var e;if("undefined"===me(et))return!1;for(e in et)try{-1===tn(Qn,e)&&U(et,e)&&null!==et[e]&&"object"===me(et[e])&&Hn(et[e])}catch(e){return!0}return!1}(),tt="undefined"!=typeof window,it=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"];Kn=Mn?function(){return 2!==(Rn(arguments)||"").length}(1,2)?function(e){return Yn(e)?Rn(qn.call(e)):Rn(e)}:Rn:function(e){var n,t,i,r,o,l,s;if(r=[],Yn(e)){for(s=0;s0&&!U(e,"0"))for(s=0;s1){if(i=function(e,n){return Oe(n)?(U(n,"thisArg")&&(e.thisArg=n.thisArg),U(n,"series")&&(e.series=n.series,!M(e.series))?new TypeError(S("invalid option. `%s` option must be a boolean. Option: `%s`.","series",e.series)):U(n,"limit")&&(e.limit=n.limit,!Je(e.limit))?new TypeError(S("invalid option. `%s` option must be a positive integer. Option: `%s`.","limit",e.limit)):null):new TypeError(S("invalid argument. Options argument must be an object. Value: `%s`.",n))}(t,e),i)throw i;r=n}else r=e;if(!ge(r))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",r));return t.series?t.limit=1:t.limit||(t.limit=be),function(e,n){if("object"!=typeof e||null===e)throw new TypeError(S("invalid argument. First argument must be an object. Value: `%s`.",e));if(!ge(n))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",n));return function(e,n,t,i){var r,o,l,s,u,a,c,f,m;if(l=rt(e),a=l.length,ot("Number of keys: %d",a),f={},0===a)return ot("Finished processing an object."),i(null,f);for(u=a %s: %s",n,JSON.stringify(i)),f[n]=i,p()}}r=l[c+=1],i=e[r],ot("%s: %s",r,JSON.stringify(i)),2===t.length?t.call(n.thisArg,r,o):3===t.length?t.call(n.thisArg,r,i,o):t.call(n.thisArg,r,i,e,o)}function p(e){return e?(ot("Encountered an error: %s",e.message),i(e)):(ot("Processed %d of %d properties.",o+=1,a),c1){if(i=function(e,n){return Oe(n)?(U(n,"thisArg")&&(e.thisArg=n.thisArg),U(n,"series")&&(e.series=n.series,!M(e.series))?new TypeError(S("invalid option. `%s` option must be a boolean. Option: `%s`.","series",e.series)):U(n,"limit")&&(e.limit=n.limit,!Je(e.limit))?new TypeError(S("invalid option. `%s` option must be a positive integer. Option: `%s`.","limit",e.limit)):null):new TypeError(S("invalid argument. Options argument must be an object. Value: `%s`.",n))}(t,e),i)throw i;r=n}else r=e;if(!ge(r))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",r));return t.series?t.limit=1:t.limit||(t.limit=be),function(e,n){if("object"!=typeof e||null===e)throw new TypeError(S("invalid argument. First argument must be an object. Value: `%s`.",e));if(!ge(n))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",n));return function(e,n,t,i){var r,o,l,s,u,a,c,f,m;if(l=rt(e),a=l.length,ut("Number of keys: %d",a),f={},0===a)return ut("Finished processing an object."),i(null,f);for(u=a %s: %s",i,JSON.stringify(n)),f[i]=n,p()}}i=l[c+=1],ut("%s: %s",i,JSON.stringify(e[i])),2===t.length?t.call(n.thisArg,e[i],r):3===t.length?t.call(n.thisArg,e[i],i,r):t.call(n.thisArg,e[i],i,e,r)}function p(e){return e?(ut("Encountered an error: %s",e.message),i(e)):(ut("Processed %d of %d properties.",o+=1,a),c1){if(i=function(e,n){return Oe(n)?(U(n,"thisArg")&&(e.thisArg=n.thisArg),U(n,"series")&&(e.series=n.series,!M(e.series))?new TypeError(S("invalid option. `%s` option must be a boolean. Option: `%s`.","series",e.series)):U(n,"limit")&&(e.limit=n.limit,!Je(e.limit))?new TypeError(S("invalid option. `%s` option must be a positive integer. Option: `%s`.","limit",e.limit)):null):new TypeError(S("invalid argument. Options argument must be an object. Value: `%s`.",n))}(t,e),i)throw i;r=n}else r=e;if(!ge(r))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",r));return t.series?t.limit=1:t.limit||(t.limit=be),function(e,n){if(!ye(e))throw new TypeError(S("invalid argument. First argument must be a collection. Value: `%s`.",e));if(!ge(n))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",n));return function(e,n,t,i){var r,o,l,s,u,a,c;if(u=e.length,ft("Collection length: %d",u),0===u)return ft("Finished processing a collection."),i(null,!0);for(s=u1){if(i=function(e,n){return Oe(n)?(U(n,"thisArg")&&(e.thisArg=n.thisArg),U(n,"series")&&(e.series=n.series,!M(e.series))?new TypeError(S("invalid option. `%s` option must be a boolean. Option: `%s`.","series",e.series)):U(n,"limit")&&(e.limit=n.limit,!Je(e.limit))?new TypeError(S("invalid option. `%s` option must be a positive integer. Option: `%s`.","limit",e.limit)):null):new TypeError(S("invalid argument. Options argument must be an object. Value: `%s`.",n))}(t,e),i)throw i;r=n}else r=e;if(!ge(r))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",r));return t.series?t.limit=1:t.limit||(t.limit=be),function(e,n){if(!ye(e))throw new TypeError(S("invalid argument. First argument must be a collection. Value: `%s`.",e));if(!ge(n))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",n));return function(e,n,t,i){var r,o,l,s,u,a;if(s=e.length,pt("Collection length: %d",s),0===s)return pt("Finished processing a collection."),i(null,!0);for(l=s0&&c();function c(){pt("Collection element %d: %s.",u-=1,JSON.stringify(e[u])),2===t.length?t.call(n.thisArg,e[u],f):3===t.length?t.call(n.thisArg,e[u],u,f):t.call(n.thisArg,e[u],u,e,f)}function f(e,n){if(!o)return e?(o=!0,pt("Encountered an error: %s",e.message),i(e)):(pt("Processed %d of %d collection elements.",r+=1,s),pt("Test result: %s",!!n),n&&!o?(o=!0,pt("Finished processing a collection."),i(null,!1)):u>0?c():r===s?(pt("Finished processing a collection."),i(null,!0)):void 0)}}(e,t,r,(function(e,t){if(e)return n(e,!1);n(null,t)}))}}function dt(e,n,t,i){if(arguments.length<4)return ht(n)(e,t);ht(n,t)(e,i)}R(dt,"factory",ht);var yt=$e("reduce-async:limit");function vt(e,n){var t,i,r;if(t={},arguments.length>1){if(i=function(e,n){return Oe(n)?(U(n,"thisArg")&&(e.thisArg=n.thisArg),U(n,"series")&&(e.series=n.series,!M(e.series))?new TypeError(S("invalid option. `%s` option must be a boolean. Option: `%s`.","series",e.series)):U(n,"limit")&&(e.limit=n.limit,!Je(e.limit))?new TypeError(S("invalid option. `%s` option must be a positive integer. Option: `%s`.","limit",e.limit)):null):new TypeError(S("invalid argument. Options argument must be an object. Value: `%s`.",n))}(t,e),i)throw i;r=n}else r=e;if(!ge(r))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",r));return void 0===t.series&&void 0===t.limit&&(t.series=!0),t.series?t.limit=1:t.limit||(t.limit=be),function(e,n,i){if(!ye(e))throw new TypeError(S("invalid argument. First argument must be a collection. Value: `%s`.",e));if(!ge(i))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",i));return function(e,n,t,i,r){var o,l,s,u,a,c,f;if(a=e.length,yt("Collection length: %d",a),0===a)return yt("Finished processing a collection."),r(null,n);for(u=a1){if(i=function(e,n){return Oe(n)?(U(n,"thisArg")&&(e.thisArg=n.thisArg),U(n,"series")&&(e.series=n.series,!M(e.series))?new TypeError(S("invalid option. `%s` option must be a boolean. Option: `%s`.","series",e.series)):U(n,"limit")&&(e.limit=n.limit,!Je(e.limit))?new TypeError(S("invalid option. `%s` option must be a positive integer. Option: `%s`.","limit",e.limit)):null):new TypeError(S("invalid argument. Options argument must be an object. Value: `%s`.",n))}(t,e),i)throw i;r=n}else r=e;if(!ge(r))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",r));return void 0===t.series&&void 0===t.limit&&(t.series=!0),t.series?t.limit=1:t.limit||(t.limit=be),function(e,n,i){if(!ye(e))throw new TypeError(S("invalid argument. First argument must be a collection. Value: `%s`.",e));if(!ge(i))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",i));return function(e,n,t,i,r){var o,l,s,u,a,c;if(u=e.length,wt("Collection length: %d",u),0===u)return wt("Finished processing a collection."),r(null,n);for(s=u0&&f();function f(){function r(e,t){if(!l){if(e)return l=!0,m(e);wt("Accumulator: %s",JSON.stringify(t)),n=t,m()}}wt("Collection element %d: %s.",a-=1,JSON.stringify(e[a])),3===i.length?i.call(t.thisArg,n,e[a],r):4===i.length?i.call(t.thisArg,n,e[a],a,r):i.call(t.thisArg,n,e[a],a,e,r)}function m(e){return e?(wt("Encountered an error: %s",e.message),r(e)):(wt("Processed %d of %d collection elements.",o+=1,u),a>0?f():o===u?(wt("Finished processing a collection."),r(null,n)):void 0)}}(e,n,t,r,(function(e,n){if(e)return i(e);i(null,n)}))}}function Tt(e,n,t,i,r){if(arguments.length<5)return Et(t)(e,n,i);Et(t,i)(e,n,r)}R(Tt,"factory",Et);var At=4294967295,Ot=function(e){if("function"!=typeof e)throw new TypeError(S("invalid argument. Must provide a function. Value: `%s`.",e));return function(n){var t,i;if(!function(e){return null!=e&&"function"!=typeof e&&"number"==typeof e.length&&he(e.length)&&e.length>=0&&e.length<=At}(n))return!1;if(0===(t=n.length))return!1;for(i=0;i=e.length)return n();for(l=arguments.length,o=new Array(l),s=0;s1){if(i=function(e,n){return Oe(n)?(U(n,"thisArg")&&(e.thisArg=n.thisArg),U(n,"series")&&(e.series=n.series,!M(e.series))?new TypeError(S("invalid option. `%s` option must be a boolean. Option: `%s`.","series",e.series)):U(n,"limit")&&(e.limit=n.limit,!Je(e.limit))?new TypeError(S("invalid option. `%s` option must be a positive integer. Option: `%s`.","limit",e.limit)):null):new TypeError(S("invalid argument. Options argument must be an object. Value: `%s`.",n))}(t,e),i)throw i;r=n}else r=e;if(!ge(r))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",r));return t.series?t.limit=1:t.limit||(t.limit=be),function(e,n,i){if(!ye(e))throw new TypeError(S("invalid argument. First argument must be a collection. Value: `%s`.",e));if(!Je(n))throw new TypeError(S("invalid argument. Second argument must be a positive integer. Value: `%s`.",n));if(!ge(i))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",i));return function(e,n,t,i,r){var o,l,s,u,a,c,f,m;if(a=e.length,jt("Collection length: %d",a),0===a)return jt("Finished processing a collection."),r(null,!1);for(u=a1){if(i=function(e,n){return Oe(n)?(U(n,"thisArg")&&(e.thisArg=n.thisArg),U(n,"series")&&(e.series=n.series,!M(e.series))?new TypeError(S("invalid option. `%s` option must be a boolean. Option: `%s`.","series",e.series)):U(n,"limit")&&(e.limit=n.limit,!Je(e.limit))?new TypeError(S("invalid option. `%s` option must be a positive integer. Option: `%s`.","limit",e.limit)):null):new TypeError(S("invalid argument. Options argument must be an object. Value: `%s`.",n))}(t,e),i)throw i;r=n}else r=e;if(!ge(r))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",r));return t.series?t.limit=1:t.limit||(t.limit=be),function(e,n,i){if(!ye(e))throw new TypeError(S("invalid argument. First argument must be a collection. Value: `%s`.",e));if(!Je(n))throw new TypeError(S("invalid argument. Second argument must be a positive integer. Value: `%s`.",n));if(!ge(i))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",i));return function(e,n,t,i,r){var o,l,s,u,a,c,f;if(u=e.length,Nt("Collection length: %d",u),0===u)return Nt("Finished processing a collection."),r(null,!1);for(s=u0&&m();function m(){Nt("Collection element %d: %s.",a-=1,JSON.stringify(e[a])),2===i.length?i.call(t.thisArg,e[a],g):3===i.length?i.call(t.thisArg,e[a],a,g):i.call(t.thisArg,e[a],a,e,g)}function g(e,t){if(!l)return e?(l=!0,Nt("Encountered an error: %s",e.message),r(e)):(Nt("Processed %d of %d collection elements.",o+=1,u),Nt("Test result: %s",!!t),t&&!l&&(c+=1)===n?(l=!0,Nt("Finished processing a collection."),r(null,!0)):a>0?m():o===u?(Nt("Finished processing a collection."),r(null,!1)):void 0)}}(e,n,t,r,(function(e,n){if(e)return i(e,!1);i(null,n)}))}}function Pt(e,n,t,i,r){if(arguments.length<5)return Lt(t)(e,n,i);Lt(t,i)(e,n,r)}R(Pt,"factory",Lt);var _t=$e("tabulate-by-async:limit");function kt(e,n){var t,i,r;if(t={},arguments.length>1){if(i=function(e,n){return Oe(n)?(U(n,"thisArg")&&(e.thisArg=n.thisArg),U(n,"series")&&(e.series=n.series,!M(e.series))?new TypeError(S("invalid option. `%s` option must be a boolean. Option: `%s`.","series",e.series)):U(n,"limit")&&(e.limit=n.limit,!Je(e.limit))?new TypeError(S("invalid option. `%s` option must be a positive integer. Option: `%s`.","limit",e.limit)):null):new TypeError(S("invalid argument. Options argument must be an object. Value: `%s`.",n))}(t,e),i)throw i;r=n}else r=e;if(!ge(r))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",r));return t.series?t.limit=1:t.limit||(t.limit=be),function(e,n){if(!ye(e))throw new TypeError(S("invalid argument. First argument must be a collection. Value: `%s`.",e));if(!ge(n))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",n));return function(e,n,t,i){var r,o,l,s,u,a,c,f,m;if(u=e.length,_t("Collection length: %d",u),c=[],0===u)return _t("Finished processing a collection."),i(null,c);for(f=[],s=u1)for(r=new Array(arguments.length-1),i=1;i1)for(r=new Array(arguments.length-1),i=1;i1)for(r=new Array(arguments.length-1),i=1;i1)for(r=new Array(arguments.length-1),i=1;i 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) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\nvar obj = ( typeof globalThis === 'object' ) ? globalThis : null; // eslint-disable-line no-undef\n\n\n// EXPORTS //\n\nexport default obj;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport getGlobal from '@stdlib/utils-global';\n\n\n// MAIN //\n\nvar root = getGlobal();\nvar nodeList = root.document && root.document.childNodes;\n\n\n// EXPORTS //\n\nexport default nodeList;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isBoolean } from '@stdlib/assert-is-boolean';\nimport format from '@stdlib/string-format';\nimport getThis from './codegen.js';\nimport Self from './self.js';\nimport Win from './window.js';\nimport GlobalThis from './global_this.js';\n\n\n// MAIN //\n\n/**\n* Returns the global object.\n*\n* ## Notes\n*\n* - Using code generation is the **most** reliable way to resolve the global object; however, doing so is likely to violate content security policies (CSPs) in, e.g., Chrome Apps and elsewhere.\n*\n* @private\n* @param {boolean} [codegen=false] - boolean indicating whether to use code generation to resolve the global object\n* @throws {TypeError} must provide a boolean\n* @throws {Error} unable to resolve global object\n* @returns {Object} global object\n*\n* @example\n* var g = getGlobal();\n* // returns {...}\n*/\nfunction getGlobal( codegen ) {\n\tif ( arguments.length ) {\n\t\tif ( !isBoolean( codegen ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Must provide a boolean. Value: `%s`.', codegen ) );\n\t\t}\n\t\tif ( codegen ) {\n\t\t\treturn getThis();\n\t\t}\n\t\t// Fall through...\n\t}\n\t// Case: 2020 revision of ECMAScript standard\n\tif ( GlobalThis ) {\n\t\treturn GlobalThis;\n\t}\n\t// Case: browsers and web workers\n\tif ( Self ) {\n\t\treturn Self;\n\t}\n\t// Case: browsers\n\tif ( Win ) {\n\t\treturn Win;\n\t}\n\t// Case: unknown\n\tthrow new Error( 'unexpected error. Unable to resolve global object.' );\n}\n\n\n// EXPORTS //\n\nexport default getGlobal;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Returns the global object using code generation.\n*\n* @private\n* @returns {Object} global object\n*/\nfunction getGlobal() {\n\treturn new Function( 'return this;' )(); // eslint-disable-line no-new-func, stdlib/require-globals\n}\n\n\n// EXPORTS //\n\nexport default getGlobal;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\nvar typedarray = Int8Array; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default typedarray;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Returns a regular expression to capture everything that is not a space immediately after the `function` keyword and before the first left parenthesis.\n*\n* @returns {RegExp} regular expression\n*\n* @example\n* var RE_FUNCTION_NAME = reFunctionName();\n*\n* function fname( fcn ) {\n* return RE_FUNCTION_NAME.exec( fcn.toString() )[ 1 ];\n* }\n*\n* var fn = fname( Math.sqrt );\n* // returns 'sqrt'\n*\n* fn = fname( Int8Array );\n* // returns 'Int8Array'\n*\n* fn = fname( Object.prototype.toString );\n* // returns 'toString'\n*\n* fn = fname( function(){} );\n* // returns ''\n*/\nfunction reFunctionName() {\n\treturn /^\\s*function\\s*([^(]*)/i;\n}\n\n\n// EXPORTS //\n\nexport default reFunctionName;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport reFunctionName from './main.js';\n\n\n// MAIN //\n\n/**\n* Captures everything that is not a space immediately after the `function` keyword and before the first left parenthesis.\n*\n* Regular expression: `/^\\s*function\\s*([^(]*)/i`\n*\n* - `/^\\s*`\n* - Match zero or more spaces at beginning\n*\n* - `function`\n* - Match the word `function`\n*\n* - `\\s*`\n* - Match zero or more spaces after the word `function`\n*\n* - `()`\n* - Capture\n*\n* - `[^(]*`\n* - Match anything except a left parenthesis `(` zero or more times\n*\n* - `/i`\n* - ignore case\n*\n* @constant\n* @type {RegExp}\n* @default /^\\s*function\\s*([^(]*)/i\n*/\nvar RE_FUNCTION_NAME = reFunctionName();\n\n\n// EXPORTS //\n\nexport default RE_FUNCTION_NAME;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Regular expression to capture everything that is not a space immediately after the `function` keyword and before the first left parenthesis.\n*\n* @module @stdlib/regexp-function-name\n*\n* @example\n* import reFunctionName from '@stdlib/regexp-function-name';\n* var RE_FUNCTION_NAME = reFunctionName();\n*\n* function fname( fcn ) {\n* return RE_FUNCTION_NAME.exec( fcn.toString() )[ 1 ];\n* }\n*\n* var fn = fname( Math.sqrt );\n* // returns 'sqrt'\n*\n* fn = fname( Int8Array );\n* // returns 'Int8Array'\n*\n* fn = fname( Object.prototype.toString );\n* // returns 'toString'\n*\n* fn = fname( function(){} );\n* // returns ''\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport REGEXP from './regexp.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'REGEXP', REGEXP );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar f;\n\n\n// FUNCTIONS //\n\n/**\n* Tests if a value is an array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an array\n*\n* @example\n* var bool = isArray( [] );\n* // returns true\n*\n* @example\n* var bool = isArray( {} );\n* // returns false\n*/\nfunction isArray( value ) {\n\treturn ( nativeClass( value ) === '[object Array]' );\n}\n\n\n// MAIN //\n\nif ( Array.isArray ) {\n\tf = Array.isArray;\n} else {\n\tf = isArray;\n}\n\n\n// EXPORTS //\n\nexport default f;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Tests if a value is object-like.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is object-like\n*\n* @example\n* var bool = isObjectLike( {} );\n* // returns true\n*\n* @example\n* var bool = isObjectLike( [] );\n* // returns true\n*\n* @example\n* var bool = isObjectLike( null );\n* // returns false\n*/\nfunction isObjectLike( value ) {\n\treturn (\n\t\tvalue !== null &&\n\t\ttypeof value === 'object'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isObjectLike;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\nimport { REGEXP as RE } from '@stdlib/regexp-function-name';\nimport isBuffer from '@stdlib/assert-is-buffer';\n\n\n// MAIN //\n\n/**\n* Determines the name of a value's constructor.\n*\n* @param {*} v - input value\n* @returns {string} name of a value's constructor\n*\n* @example\n* var v = constructorName( 'a' );\n* // returns 'String'\n*\n* @example\n* var v = constructorName( 5 );\n* // returns 'Number'\n*\n* @example\n* var v = constructorName( null );\n* // returns 'Null'\n*\n* @example\n* var v = constructorName( undefined );\n* // returns 'Undefined'\n*\n* @example\n* var v = constructorName( function noop() {} );\n* // returns 'Function'\n*/\nfunction constructorName( v ) {\n\tvar match;\n\tvar name;\n\tvar ctor;\n\tname = nativeClass( v ).slice( 8, -1 );\n\tif ( (name === 'Object' || name === 'Error') && v.constructor ) {\n\t\tctor = v.constructor;\n\t\tif ( typeof ctor.name === 'string' ) {\n\t\t\treturn ctor.name;\n\t\t}\n\t\tmatch = RE.exec( ctor.toString() );\n\t\tif ( match ) {\n\t\t\treturn match[ 1 ];\n\t\t}\n\t}\n\tif ( isBuffer( v ) ) {\n\t\treturn 'Buffer';\n\t}\n\treturn name;\n}\n\n\n// EXPORTS //\n\nexport default constructorName;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isObjectLike from '@stdlib/assert-is-object-like';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Buffer instance.\n*\n* @param {*} value - value to validate\n* @returns {boolean} boolean indicating if a value is a Buffer instance\n*\n* @example\n* var v = isBuffer( new Buffer( 'beep' ) );\n* // returns true\n*\n* @example\n* var v = isBuffer( new Buffer( [1,2,3,4] ) );\n* // returns true\n*\n* @example\n* var v = isBuffer( {} );\n* // returns false\n*\n* @example\n* var v = isBuffer( [] );\n* // returns false\n*/\nfunction isBuffer( value ) {\n\treturn (\n\t\tisObjectLike( value ) &&\n\t\t(\n\t\t\t// eslint-disable-next-line no-underscore-dangle\n\t\t\tvalue._isBuffer || // for envs missing Object.prototype.constructor (e.g., Safari 5-7)\n\t\t\t(\n\t\t\t\tvalue.constructor &&\n\n\t\t\t\t// WARNING: `typeof` is not a foolproof check, as certain envs consider RegExp and NodeList instances to be functions\n\t\t\t\ttypeof value.constructor.isBuffer === 'function' &&\n\t\t\t\tvalue.constructor.isBuffer( value )\n\t\t\t)\n\t\t)\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isBuffer;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\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/**\n* Determine a value's type.\n*\n* @module @stdlib/utils-type-of\n*\n* @example\n* import typeOf from '@stdlib/utils-type-of';\n*\n* var str = typeOf( 'a' );\n* // returns 'string'\n*\n* str = typeOf( 5 );\n* // returns 'number'\n*/\n\n// MODULES //\n\nimport usePolyfill from './check.js';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main = ( usePolyfill() ) ? polyfill : builtin;\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport RE from './fixtures/re.js';\nimport nodeList from './fixtures/nodelist.js';\nimport typedarray from './fixtures/typedarray.js';\n\n\n// MAIN //\n\n/**\n* Checks whether a polyfill is needed when using the `typeof` operator.\n*\n* @private\n* @returns {boolean} boolean indicating whether a polyfill is needed\n*/\nfunction check() {\n\tif (\n\t\t// Chrome 1-12 returns 'function' for regular expression instances (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof):\n\t\ttypeof RE === 'function' ||\n\n\t\t// Safari 8 returns 'object' for typed array and weak map constructors (underscore #1929):\n\t\ttypeof typedarray === 'object' ||\n\n\t\t// PhantomJS 1.9 returns 'function' for `NodeList` instances (underscore #2236):\n\t\ttypeof nodeList === 'function'\n\t) {\n\t\treturn true;\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nexport default check;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport ctorName from '@stdlib/utils-constructor-name';\n\n\n// MAIN //\n\n/**\n* Determines a value's type.\n*\n* @param {*} v - input value\n* @returns {string} string indicating the value's type\n*/\nfunction typeOf( v ) {\n\treturn ctorName( v ).toLowerCase();\n}\n\n\n// EXPORTS //\n\nexport default typeOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport ctorName from '@stdlib/utils-constructor-name';\n\n\n// NOTES //\n\n/*\n* Built-in `typeof` operator behavior:\n*\n* ```text\n* typeof null => 'object'\n* typeof undefined => 'undefined'\n* typeof 'a' => 'string'\n* typeof 5 => 'number'\n* typeof NaN => 'number'\n* typeof true => 'boolean'\n* typeof false => 'boolean'\n* typeof {} => 'object'\n* typeof [] => 'object'\n* typeof function foo(){} => 'function'\n* typeof function* foo(){} => 'object'\n* typeof Symbol() => 'symbol'\n* ```\n*\n*/\n\n\n// MAIN //\n\n/**\n* Determines a value's type.\n*\n* @param {*} v - input value\n* @returns {string} string indicating the value's type\n*/\nfunction typeOf( v ) {\n\tvar type;\n\n\t// Address `typeof null` => `object` (see http://wiki.ecmascript.org/doku.php?id=harmony:typeof_null):\n\tif ( v === null ) {\n\t\treturn 'null';\n\t}\n\ttype = typeof v;\n\n\t// If the `typeof` operator returned something other than `object`, we are done. Otherwise, we need to check for an internal class name or search for a constructor.\n\tif ( type === 'object' ) {\n\t\treturn ctorName( v ).toLowerCase();\n\t}\n\treturn type;\n}\n\n\n// EXPORTS //\n\nexport default typeOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport typeOf from '@stdlib/utils-type-of';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a function.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a function\n*\n* @example\n* function beep() {\n* return 'beep';\n* }\n*\n* var bool = isFunction( beep );\n* // returns true\n*/\nfunction isFunction( value ) {\n\t// Note: cannot use `typeof` directly, as various browser engines incorrectly return `'function'` when operating on non-function objects, such as regular expressions and NodeLists.\n\treturn ( typeOf( value ) === 'function' );\n}\n\n\n// EXPORTS //\n\nexport default isFunction;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// 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/**\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/**\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// 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) 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// MAIN //\n\nvar getProto = Object.getPrototypeOf;\n\n\n// EXPORTS //\n\nexport default getProto;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport nativeClass from '@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 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 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/**\n* Tests if a value is a number primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number primitive\n*\n* @example\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* @example\n* var bool = isNumber( NaN );\n* // returns true\n*\n* @example\n* var bool = isNumber( new Number( 3.14 ) );\n* // returns false\n*/\nfunction isNumber( value ) {\n\treturn ( typeof value === 'number' );\n}\n\n\n// EXPORTS //\n\nexport default isNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// EXPORTS //\n\nexport default Number; // eslint-disable-line stdlib/require-globals\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Number from '@stdlib/number-ctor';\n\n\n// MAIN //\n\n// eslint-disable-next-line stdlib/no-redeclare\nvar toString = Number.prototype.toString; // non-generic\n\n\n// EXPORTS //\n\nexport default toString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport nativeClass from '@stdlib/utils-native-class';\nimport Number from '@stdlib/number-ctor';\nimport test from './try2serialize.js';\n\n\n// VARIABLES //\n\nvar FLG = hasToStringTag();\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object\n*\n* @example\n* var bool = isNumber( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isNumber( new Number( 3.14 ) );\n* // returns true\n*/\nfunction isNumber( value ) {\n\tif ( typeof value === 'object' ) {\n\t\tif ( value instanceof Number ) {\n\t\t\treturn true;\n\t\t}\n\t\tif ( FLG ) {\n\t\t\treturn test( value );\n\t\t}\n\t\treturn ( nativeClass( value ) === '[object Number]' );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nexport default isNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport toString from './tostring.js'; // eslint-disable-line stdlib/no-redeclare\n\n\n// MAIN //\n\n/**\n* Attempts to serialize a value to a string.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value can be serialized\n*/\nfunction test( value ) {\n\ttry {\n\t\ttoString.call( value );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isPrimitive from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a number\n*\n* @example\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* @example\n* var bool = isNumber( new Number( 3.14 ) );\n* // returns true\n*\n* @example\n* var bool = isNumber( NaN );\n* // returns true\n*\n* @example\n* var bool = isNumber( null );\n* // returns false\n*/\nfunction isNumber( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nexport default isNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Test if a value is a number.\n*\n* @module @stdlib/assert-is-number\n*\n* @example\n* import isNumber from '@stdlib/assert-is-number';\n*\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* bool = isNumber( new Number( 3.14 ) );\n* // returns true\n*\n* bool = isNumber( NaN );\n* // returns true\n*\n* bool = isNumber( null );\n* // returns false\n*\n* @example\n* import { isPrimitive as isNumber } from '@stdlib/assert-is-number';\n*\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* bool = isNumber( NaN );\n* // returns true\n*\n* bool = isNumber( new Number( 3.14 ) );\n* // returns false\n*\n* @example\n* import { isObject as isNumber } from '@stdlib/assert-is-number';\n*\n* var bool = isNumber( 3.14 );\n* // returns false\n*\n* bool = isNumber( new Number( 3.14 ) );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport isPrimitive from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'isPrimitive', isPrimitive );\nsetReadOnly( main, 'isObject', isObject );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Double-precision floating-point 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// MODULES //\n\nimport PINF from '@stdlib/constants-float64-pinf';\nimport NINF from '@stdlib/constants-float64-ninf';\nimport isInt from '@stdlib/math-base-assert-is-integer';\n\n\n// MAIN //\n\n/**\n* Tests if a number primitive is an integer value.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a number primitive is an integer value\n*/\nfunction isInteger( value ) {\n\treturn (\n\t\tvalue < PINF &&\n\t\tvalue > NINF &&\n\t\tisInt( value )\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isNumber } from '@stdlib/assert-is-number';\nimport isInt from './integer.js';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number primitive having an integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number primitive having an integer value\n*\n* @example\n* var bool = isInteger( -3.0 );\n* // returns true\n*\n* @example\n* var bool = isInteger( new Number( -3.0 ) );\n* // returns false\n*/\nfunction isInteger( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tisInt( value )\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isObject as isNumber } from '@stdlib/assert-is-number';\nimport isInt from './integer.js';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object having an integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object having an integer value\n*\n* @example\n* var bool = isInteger( 3.0 );\n* // returns false\n*\n* @example\n* var bool = isInteger( new Number( 3.0 ) );\n* // returns true\n*/\nfunction isInteger( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tisInt( value.valueOf() )\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isPrimitive from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\n/**\n* Tests if a value is an integer.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an integer\n*\n* @example\n* var bool = isInteger( 5.0 );\n* // returns true\n*\n* @example\n* var bool = isInteger( new Number( 5.0 ) );\n* // returns true\n*\n* @example\n* var bool = isInteger( -3.14 );\n* // returns false\n*\n* @example\n* var bool = isInteger( null );\n* // returns false\n*/\nfunction isInteger( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nexport default isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isInteger } from '@stdlib/assert-is-integer';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number primitive having a positive integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number primitive having a positive integer value\n*\n* @example\n* var bool = isPositiveInteger( 3.0 );\n* // returns true\n*\n* @example\n* var bool = isPositiveInteger( new Number( 3.0 ) );\n* // returns false\n*/\nfunction isPositiveInteger( value ) {\n\treturn (\n\t\tisInteger( value ) &&\n\t\tvalue > 0.0\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isPositiveInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isObject as isInteger } from '@stdlib/assert-is-integer';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object having a positive integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object having a positive integer value\n*\n* @example\n* var bool = isPositiveInteger( 3.0 );\n* // returns false\n*\n* @example\n* var bool = isPositiveInteger( new Number( 3.0 ) );\n* // returns true\n*/\nfunction isPositiveInteger( value ) {\n\treturn (\n\t\tisInteger( value ) &&\n\t\tvalue.valueOf() > 0.0\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isPositiveInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isPrimitive from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a positive integer.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a positive integer\n*\n* @example\n* var bool = isPositiveInteger( 5.0 );\n* // returns true\n*\n* @example\n* var bool = isPositiveInteger( new Number( 5.0 ) );\n* // returns true\n*\n* @example\n* var bool = isPositiveInteger( 0.0 );\n* // returns false\n*\n* @example\n* var bool = isPositiveInteger( -5.0 );\n* // returns false\n*\n* @example\n* var bool = isPositiveInteger( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isPositiveInteger( null );\n* // returns false\n*/\nfunction isPositiveInteger( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nexport default isPositiveInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Test if a value is an integer.\n*\n* @module @stdlib/assert-is-integer\n*\n* @example\n* import isInteger from '@stdlib/assert-is-integer';\n*\n* var bool = isInteger( 5.0 );\n* // returns true\n*\n* bool = isInteger( new Number( 5.0 ) );\n* // returns true\n*\n* bool = isInteger( -3.14 );\n* // returns false\n*\n* bool = isInteger( null );\n* // returns false\n*\n* @example\n* // Use interface to check for integer primitives...\n* import { isPrimitive as isInteger } from '@stdlib/assert-is-integer';\n*\n* var bool = isInteger( -3.0 );\n* // returns true\n*\n* bool = isInteger( new Number( -3.0 ) );\n* // returns false\n*\n* @example\n* // Use interface to check for integer objects...\n* import { isObject as isInteger } from '@stdlib/assert-is-integer';\n*\n* var bool = isInteger( 3.0 );\n* // returns false\n*\n* bool = isInteger( new Number( 3.0 ) );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport isPrimitive from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'isPrimitive', isPrimitive );\nsetReadOnly( main, 'isObject', isObject );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Test if a value is a positive integer.\n*\n* @module @stdlib/assert-is-positive-integer\n*\n* @example\n* import isPositiveInteger from '@stdlib/assert-is-positive-integer';\n*\n* var bool = isPositiveInteger( 5.0 );\n* // returns true\n*\n* bool = isPositiveInteger( new Number( 5.0 ) );\n* // returns true\n*\n* bool = isPositiveInteger( -5.0 );\n* // returns false\n*\n* bool = isPositiveInteger( 3.14 );\n* // returns false\n*\n* bool = isPositiveInteger( null );\n* // returns false\n*\n* @example\n* import { isPrimitive as isPositiveInteger } from '@stdlib/assert-is-positive-integer';\n*\n* var bool = isPositiveInteger( 3.0 );\n* // returns true\n*\n* bool = isPositiveInteger( new Number( 3.0 ) );\n* // returns false\n*\n* @example\n* import { isObject as isPositiveInteger } from '@stdlib/assert-is-positive-integer';\n*\n* var bool = isPositiveInteger( 3.0 );\n* // returns false\n*\n* bool = isPositiveInteger( new Number( 3.0 ) );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport isPrimitive from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'isPrimitive', isPrimitive );\nsetReadOnly( main, 'isObject', isObject );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'any-by-async:limit' );\n\n\n// MAIN //\n\n/**\n* Invokes a predicate function once for each element in a collection, limiting the number of concurrently pending functions.\n*\n* @private\n* @param {Collection} collection - input collection\n* @param {Options} opts - function options\n* @param {*} [opts.thisArg] - execution context\n* @param {PositiveInteger} [opts.limit] - maximum number of pending function invocations\n* @param {Function} predicate - predicate function\n* @param {Callback} done - function to invoke upon completion or upon encountering an error\n* @returns {void}\n*/\nfunction limit( collection, opts, predicate, done ) {\n\tvar maxIndex;\n\tvar count;\n\tvar flg;\n\tvar lim;\n\tvar len;\n\tvar idx;\n\tvar i;\n\n\tlen = collection.length;\n\tdebug( 'Collection length: %d', len );\n\n\tif ( len === 0 ) {\n\t\tdebug( 'Finished processing a collection.' );\n\t\treturn done( null, false );\n\t}\n\tif ( len < opts.limit ) {\n\t\tlim = len;\n\t} else {\n\t\tlim = opts.limit;\n\t}\n\tdebug( 'Concurrency limit: %d', lim );\n\tdebug( 'Number of arguments: %d', predicate.length );\n\n\tmaxIndex = len - 1;\n\tcount = 0;\n\tidx = -1;\n\tfor ( i = 0; i < lim; i++ ) {\n\t\t// This guard is necessary to protect against synchronous functions which exhaust all collection elements...\n\t\tif ( idx < maxIndex ) {\n\t\t\tnext(); // eslint-disable-line node/callback-return\n\t\t}\n\t}\n\n\t/**\n\t* Callback to invoke a provided function for the next element in a collection.\n\t*\n\t* @private\n\t*/\n\tfunction next() {\n\t\tidx += 1;\n\t\tdebug( 'Collection element %d: %s.', idx, JSON.stringify( collection[ idx ] ) );\n\t\tif ( predicate.length === 2 ) {\n\t\t\tpredicate.call( opts.thisArg, collection[ idx ], clbk );\n\t\t} else if ( predicate.length === 3 ) {\n\t\t\tpredicate.call( opts.thisArg, collection[ idx ], idx, clbk );\n\t\t} else {\n\t\t\tpredicate.call( opts.thisArg, collection[ idx ], idx, collection, clbk ); // eslint-disable-line max-len\n\t\t}\n\t}\n\n\t/**\n\t* Callback invoked once a provided function finishes processing a collection element.\n\t*\n\t* @private\n\t* @param {*} [error] - error\n\t* @param {*} [result] - test result\n\t* @returns {void}\n\t*/\n\tfunction clbk( error, result ) {\n\t\tif ( flg ) {\n\t\t\t// Prevent further processing of collection elements:\n\t\t\treturn;\n\t\t}\n\t\tif ( error ) {\n\t\t\tflg = true;\n\t\t\tdebug( 'Encountered an error: %s', error.message );\n\t\t\treturn done( error );\n\t\t}\n\t\tcount += 1;\n\t\tdebug( 'Processed %d of %d collection elements.', count, len );\n\n\t\tdebug( 'Test result: %s', !!result );\n\t\tif ( result && !flg ) {\n\t\t\tflg = true;\n\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\treturn done( null, true );\n\t\t}\n\t\tif ( idx < maxIndex ) {\n\t\t\treturn next();\n\t\t}\n\t\tif ( count === len ) {\n\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\treturn done( null, false );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default limit;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isCollection from '@stdlib/assert-is-collection';\nimport format from '@stdlib/string-format';\nimport PINF from '@stdlib/constants-float64-pinf';\nimport validate from './validate.js';\nimport limit from './limit.js';\n\n\n// MAIN //\n\n/**\n* Returns a function for testing whether at least one element in a collection passes a test implemented by a predicate function.\n*\n* ## Notes\n*\n* - If a predicate function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} predicate - predicate function to invoke for each element in a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} last argument must be a function\n* @returns {Function} function which invokes the predicate function once for each element in a collection\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* var opts = {\n* 'series': true\n* };\n*\n* // Create a `anyByAsync` function which invokes the predicate function for each collection element sequentially:\n* var anyByAsync = factory( opts, predicate );\n*\n* // Create a collection over which to iterate:\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* // Define a callback which handles results:\n* function done( error, bool ) {\n* if ( error ) {\n* throw error;\n* }\n* if ( bool ) {\n* console.log( 'Successfully read at least one file.' );\n* } else {\n* console.log( 'Unable to read any files.' );\n* }\n* }\n*\n* // Try to read each element in `files`:\n* anyByAsync( files, done );\n*/\nfunction factory( options, predicate ) {\n\tvar opts;\n\tvar err;\n\tvar f;\n\n\topts = {};\n\tif ( arguments.length > 1 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t\tf = predicate;\n\t} else {\n\t\tf = options;\n\t}\n\tif ( !isFunction( f ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', f ) );\n\t}\n\tif ( opts.series ) {\n\t\topts.limit = 1;\n\t} else if ( !opts.limit ) {\n\t\topts.limit = PINF;\n\t}\n\treturn anyByAsync;\n\n\t/**\n\t* Invokes a predicate function for each element in a collection.\n\t*\n\t* @private\n\t* @param {Collection} collection - input collection\n\t* @param {Callback} done - function to invoke upon completion\n\t* @throws {TypeError} first argument must be a collection\n\t* @throws {TypeError} last argument must be a function\n\t* @returns {void}\n\t*/\n\tfunction anyByAsync( collection, done ) {\n\t\tif ( !isCollection( collection ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a collection. Value: `%s`.', collection ) );\n\t\t}\n\t\tif ( !isFunction( done ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t\t}\n\t\treturn limit( collection, opts, f, clbk );\n\n\t\t/**\n\t\t* Callback invoked upon completion.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {boolean} bool - test result\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction clbk( error, bool ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error, false );\n\t\t\t}\n\t\t\tdone( null, bool );\n\t\t}\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 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 isPositiveInteger } from '@stdlib/assert-is-positive-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 {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'thisArg': {},\n* 'series': false,\n* 'limit': 10\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, 'thisArg' ) ) {\n\t\topts.thisArg = options.thisArg;\n\t}\n\tif ( hasOwnProp( options, 'series' ) ) {\n\t\topts.series = options.series;\n\t\tif ( !isBoolean( opts.series ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'series', opts.series ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'limit' ) ) {\n\t\topts.limit = options.limit;\n\t\tif ( !isPositiveInteger( opts.limit ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport factory from './factory.js';\n\n\n// MAIN //\n\n/**\n* Tests whether at least one element in a collection passes a test implemented by a predicate function.\n*\n* ## Notes\n*\n* - If a predicate function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Collection} collection - input collection\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} predicate - predicate function to invoke for each element in a collection\n* @param {Callback} done - function to invoke upon completion\n* @throws {TypeError} first argument must be a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} second-to-last argument must be a function\n* @throws {TypeError} last argument must be a function\n* @returns {void}\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function done( error, bool ) {\n* if ( error ) {\n* throw error;\n* }\n* if ( bool ) {\n* console.log( 'Successfully read at least one file.' );\n* } else {\n* console.log( 'Unable to read any files.' );\n* }\n* }\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* anyByAsync( files, predicate, done );\n*/\nfunction anyByAsync( collection, options, predicate, done ) {\n\tif ( arguments.length < 4 ) {\n\t\treturn factory( options )( collection, predicate );\n\t}\n\tfactory( options, predicate )( collection, done );\n}\n\n\n// EXPORTS //\n\nexport default anyByAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\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 whether at least one element in a collection passes a test implemented by a predicate function.\n*\n* @module @stdlib/utils-async-any-by\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n* import anyByAsync from '@stdlib/utils-async-any-by';\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* function done( error, bool ) {\n* if ( error ) {\n* throw error;\n* }\n* if ( bool ) {\n* console.log( 'Successfully read at least one file.' );\n* } else {\n* console.log( 'Unable to read any files.' );\n* }\n* }\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* anyByAsync( files, predicate, done );\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'any-by-right-async:limit' );\n\n\n// MAIN //\n\n/**\n* Invokes a predicate function once for each element in a collection, limiting the number of concurrently pending functions and iterating from right to left.\n*\n* @private\n* @param {Collection} collection - input collection\n* @param {Options} opts - function options\n* @param {*} [opts.thisArg] - execution context\n* @param {PositiveInteger} [opts.limit] - maximum number of pending function invocations\n* @param {Function} predicate - predicate function\n* @param {Callback} done - function to invoke upon completion or upon encountering an error\n* @returns {void}\n*/\nfunction limit( collection, opts, predicate, done ) {\n\tvar count;\n\tvar flg;\n\tvar lim;\n\tvar len;\n\tvar idx;\n\tvar i;\n\n\tlen = collection.length;\n\tdebug( 'Collection length: %d', len );\n\n\tif ( len === 0 ) {\n\t\tdebug( 'Finished processing a collection.' );\n\t\treturn done( null, false );\n\t}\n\tif ( len < opts.limit ) {\n\t\tlim = len;\n\t} else {\n\t\tlim = opts.limit;\n\t}\n\tdebug( 'Concurrency limit: %d', lim );\n\tdebug( 'Number of arguments: %d', predicate.length );\n\n\tcount = 0;\n\tidx = len;\n\tfor ( i = 0; i < lim; i++ ) {\n\t\t// This guard is necessary to protect against synchronous functions which exhaust all collection elements...\n\t\tif ( idx > 0 ) {\n\t\t\tnext(); // eslint-disable-line node/callback-return\n\t\t}\n\t}\n\n\t/**\n\t* Callback to invoke a provided function for the next element in a collection.\n\t*\n\t* @private\n\t*/\n\tfunction next() {\n\t\tidx -= 1;\n\t\tdebug( 'Collection element %d: %s.', idx, JSON.stringify( collection[ idx ] ) );\n\t\tif ( predicate.length === 2 ) {\n\t\t\tpredicate.call( opts.thisArg, collection[ idx ], clbk );\n\t\t} else if ( predicate.length === 3 ) {\n\t\t\tpredicate.call( opts.thisArg, collection[ idx ], idx, clbk );\n\t\t} else {\n\t\t\tpredicate.call( opts.thisArg, collection[ idx ], idx, collection, clbk ); // eslint-disable-line max-len\n\t\t}\n\t}\n\n\t/**\n\t* Callback invoked once a provided function finishes processing a collection element.\n\t*\n\t* @private\n\t* @param {*} [error] - error\n\t* @param {*} [result] - test result\n\t* @returns {void}\n\t*/\n\tfunction clbk( error, result ) {\n\t\tif ( flg ) {\n\t\t\t// Prevent further processing of collection elements:\n\t\t\treturn;\n\t\t}\n\t\tif ( error ) {\n\t\t\tflg = true;\n\t\t\tdebug( 'Encountered an error: %s', error.message );\n\t\t\treturn done( error );\n\t\t}\n\t\tcount += 1;\n\t\tdebug( 'Processed %d of %d collection elements.', count, len );\n\n\t\tdebug( 'Test result: %s', !!result );\n\t\tif ( result && !flg ) {\n\t\t\tflg = true;\n\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\treturn done( null, true );\n\t\t}\n\t\tif ( idx > 0 ) {\n\t\t\treturn next();\n\t\t}\n\t\tif ( count === len ) {\n\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\treturn done( null, false );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default limit;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isCollection from '@stdlib/assert-is-collection';\nimport format from '@stdlib/string-format';\nimport PINF from '@stdlib/constants-float64-pinf';\nimport validate from './validate.js';\nimport limit from './limit.js';\n\n\n// MAIN //\n\n/**\n* Returns a function for testing whether at least one element in a collection passes a test implemented by a predicate function, iterating from right to left.\n*\n* ## Notes\n*\n* - If a predicate function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} predicate - predicate function to invoke for each element in a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} last argument must be a function\n* @returns {Function} function which invokes the predicate function once for each element in a collection\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* var opts = {\n* 'series': true\n* };\n*\n* // Create a `anyByRightAsync` function which invokes the predicate function for each collection element sequentially:\n* var anyByRightAsync = factory( opts, predicate );\n*\n* // Create a collection over which to iterate:\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* // Define a callback which handles results:\n* function done( error, bool ) {\n* if ( error ) {\n* throw error;\n* }\n* if ( bool ) {\n* console.log( 'Successfully read at least one file.' );\n* } else {\n* console.log( 'Unable to read any files.' );\n* }\n* }\n*\n* // Try to read each element in `files`:\n* anyByRightAsync( files, done );\n*/\nfunction factory( options, predicate ) {\n\tvar opts;\n\tvar err;\n\tvar f;\n\n\topts = {};\n\tif ( arguments.length > 1 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t\tf = predicate;\n\t} else {\n\t\tf = options;\n\t}\n\tif ( !isFunction( f ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', f ) );\n\t}\n\tif ( opts.series ) {\n\t\topts.limit = 1;\n\t} else if ( !opts.limit ) {\n\t\topts.limit = PINF;\n\t}\n\treturn anyByRightAsync;\n\n\t/**\n\t* Invokes a predicate function for each element in a collection, iterating from right to left.\n\t*\n\t* @private\n\t* @param {Collection} collection - input collection\n\t* @param {Callback} done - function to invoke upon completion\n\t* @throws {TypeError} first argument must be a collection\n\t* @throws {TypeError} last argument must be a function\n\t* @returns {void}\n\t*/\n\tfunction anyByRightAsync( collection, done ) {\n\t\tif ( !isCollection( collection ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a collection. Value: `%s`.', collection ) );\n\t\t}\n\t\tif ( !isFunction( done ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t\t}\n\t\treturn limit( collection, opts, f, clbk );\n\n\t\t/**\n\t\t* Callback invoked upon completion.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {boolean} bool - test result\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction clbk( error, bool ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error, false );\n\t\t\t}\n\t\t\tdone( null, bool );\n\t\t}\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 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 isPositiveInteger } from '@stdlib/assert-is-positive-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 {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'thisArg': {},\n* 'series': false,\n* 'limit': 10\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, 'thisArg' ) ) {\n\t\topts.thisArg = options.thisArg;\n\t}\n\tif ( hasOwnProp( options, 'series' ) ) {\n\t\topts.series = options.series;\n\t\tif ( !isBoolean( opts.series ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'series', opts.series ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'limit' ) ) {\n\t\topts.limit = options.limit;\n\t\tif ( !isPositiveInteger( opts.limit ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport factory from './factory.js';\n\n\n// MAIN //\n\n/**\n* Tests whether at least one element in a collection passes a test implemented by a predicate function, iterating from right to left.\n*\n* ## Notes\n*\n* - If a predicate function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Collection} collection - input collection\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} predicate - predicate function to invoke for each element in a collection\n* @param {Callback} done - function to invoke upon completion\n* @throws {TypeError} first argument must be a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} second-to-last argument must be a function\n* @throws {TypeError} last argument must be a function\n* @returns {void}\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function done( error, bool ) {\n* if ( error ) {\n* throw error;\n* }\n* if ( bool ) {\n* console.log( 'Successfully read at least one file.' );\n* } else {\n* console.log( 'Unable to read any files.' );\n* }\n* }\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* anyByRightAsync( files, predicate, done );\n*/\nfunction anyByRightAsync( collection, options, predicate, done ) {\n\tif ( arguments.length < 4 ) {\n\t\treturn factory( options )( collection, predicate );\n\t}\n\tfactory( options, predicate )( collection, done );\n}\n\n\n// EXPORTS //\n\nexport default anyByRightAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* 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* 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/**\n* Test whether at least one element in a collection passes a test implemented by a predicate function, iterating from right to left.\n*\n* @module @stdlib/utils-async-any-by-right\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n* import anyByRightAsync from '@stdlib/utils-async-any-by-right';\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* function done( error, bool ) {\n* if ( error ) {\n* throw error;\n* }\n* if ( bool ) {\n* console.log( 'Successfully read at least one file.' );\n* } else {\n* console.log( 'Unable to read any files.' );\n* }\n* }\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* anyByRightAsync( files, predicate, done );\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\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// 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// 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/**\n* Test if a value is a string.\n*\n* @module @stdlib/assert-is-string\n*\n* @example\n* import isString from '@stdlib/assert-is-string';\n*\n* var bool = isString( 'beep' );\n* // returns true\n*\n* bool = isString( new String( 'beep' ) );\n* // returns true\n*\n* bool = isString( 5 );\n* // returns false\n*\n* @example\n* import { isObject as isString } from '@stdlib/assert-is-string';\n*\n* var bool = isString( new String( 'beep' ) );\n* // returns true\n*\n* bool = isString( 'beep' );\n* // returns false\n*\n* @example\n* import { isPrimitive as isString } from '@stdlib/assert-is-string';\n*\n* var bool = isString( 'beep' );\n* // returns true\n*\n* bool = isString( new String( 'beep' ) );\n* // returns false\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport isPrimitive from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'isPrimitive', isPrimitive );\nsetReadOnly( main, 'isObject', isObject );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport 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 isPositiveInteger } from '@stdlib/assert-is-positive-integer';\nimport indexOf from '@stdlib/utils-index-of';\nimport format from '@stdlib/string-format';\n\n\n// VARIABLES //\n\nvar returns = [ 'values', 'indices', '*' ];\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 {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {string} [options.returns] - output format\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'thisArg': {},\n* 'series': false,\n* 'limit': 10,\n* 'returns': '*'\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, 'thisArg' ) ) {\n\t\topts.thisArg = options.thisArg;\n\t}\n\tif ( hasOwnProp( options, 'series' ) ) {\n\t\topts.series = options.series;\n\t\tif ( !isBoolean( opts.series ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'series', opts.series ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'limit' ) ) {\n\t\topts.limit = options.limit;\n\t\tif ( !isPositiveInteger( opts.limit ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'returns' ) ) {\n\t\topts.returns = options.returns;\n\t\tif ( indexOf( returns, opts.returns ) === -1 ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be one of the following: \"%s\". Option: `%s`.', 'returns', returns.join( '\", \"' ), opts.returns ) );\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' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'bifurcate-by-async:limit' );\n\n\n// MAIN //\n\n/**\n* Invokes a predicate function once for each element in a collection, limiting the number of concurrently pending functions.\n*\n* ## Notes\n*\n* - We need to cache the collection value to prevent the edge case where, during the invocation of the predicate function, the element at index `i` is swapped for some other value. For some, that might be a feature; here, we take the stance that one should be less clever.\n*\n* @private\n* @param {Collection} collection - input collection\n* @param {Options} opts - function options\n* @param {*} [opts.thisArg] - execution context\n* @param {PositiveInteger} [opts.limit] - maximum number of pending function invocations\n* @param {string} [options.returns] - output format\n* @param {Function} predicate - predicate function\n* @param {Callback} done - function to invoke upon completion or upon encountering an error\n* @returns {void}\n*/\nfunction limit( collection, opts, predicate, done ) {\n\tvar maxIndex;\n\tvar count;\n\tvar flg;\n\tvar lim;\n\tvar len;\n\tvar idx;\n\tvar out;\n\tvar i;\n\n\tlen = collection.length;\n\tdebug( 'Collection length: %d', len );\n\n\tout = [];\n\tif ( len === 0 ) {\n\t\tdebug( 'Finished processing a collection.' );\n\t\treturn done( null, out );\n\t}\n\tout.push( [], [] );\n\tif ( len < opts.limit ) {\n\t\tlim = len;\n\t} else {\n\t\tlim = opts.limit;\n\t}\n\tdebug( 'Concurrency limit: %d', lim );\n\tdebug( 'Number of arguments: %d', predicate.length );\n\n\tmaxIndex = len - 1;\n\tcount = 0;\n\tidx = -1;\n\tfor ( i = 0; i < lim; i++ ) {\n\t\t// This guard is necessary to protect against synchronous functions which exhaust all collection elements...\n\t\tif ( idx < maxIndex ) {\n\t\t\tnext(); // eslint-disable-line node/callback-return\n\t\t}\n\t}\n\t/**\n\t* Callback to invoke a provided function for the next element in a collection.\n\t*\n\t* @private\n\t*/\n\tfunction next() {\n\t\tvar v;\n\t\tvar j;\n\n\t\tidx += 1;\n\t\tj = idx;\n\t\tv = collection[ j ];\n\n\t\tdebug( 'Collection element %d: %s.', j, JSON.stringify( v ) );\n\t\tif ( predicate.length === 2 ) {\n\t\t\tpredicate.call( opts.thisArg, v, cb );\n\t\t} else if ( predicate.length === 3 ) {\n\t\t\tpredicate.call( opts.thisArg, v, j, cb );\n\t\t} else {\n\t\t\tpredicate.call( opts.thisArg, v, j, collection, cb );\n\t\t}\n\t\t/**\n\t\t* Callback invoked once a provided function finishes processing a collection element.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {*} [bool] - group indicator\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction cb( error, bool ) {\n\t\t\tif ( flg ) {\n\t\t\t\t// Prevent further processing of collection elements:\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( error ) {\n\t\t\t\tflg = true;\n\t\t\t\treturn clbk( error );\n\t\t\t}\n\t\t\tdebug( 'Collection element %d group: %s.', j, ( bool ) ? '0' : '1' );\n\n\t\t\t// Default is to return values...\n\t\t\tif ( opts.returns === 'indices' ) {\n\t\t\t\tif ( bool ) {\n\t\t\t\t\tout[ 0 ].push( j );\n\t\t\t\t} else {\n\t\t\t\t\tout[ 1 ].push( j );\n\t\t\t\t}\n\t\t\t} else if ( opts.returns === '*' ) {\n\t\t\t\tif ( bool ) {\n\t\t\t\t\tout[ 0 ].push( [ j, v ] );\n\t\t\t\t} else {\n\t\t\t\t\tout[ 1 ].push( [ j, v ] );\n\t\t\t\t}\n\t\t\t} else if ( bool ) {\n\t\t\t\tout[ 0 ].push( v );\n\t\t\t} else {\n\t\t\t\tout[ 1 ].push( v );\n\t\t\t}\n\t\t\tclbk();\n\t\t}\n\t}\n\n\t/**\n\t* Callback invoked once ready to process the next collection element.\n\t*\n\t* @private\n\t* @param {*} [error] - error\n\t* @returns {void}\n\t*/\n\tfunction clbk( error ) {\n\t\tif ( error ) {\n\t\t\tdebug( 'Encountered an error: %s', error.message );\n\t\t\treturn done( error );\n\t\t}\n\t\tcount += 1;\n\t\tdebug( 'Processed %d of %d collection elements.', count, len );\n\t\tif ( idx < maxIndex ) {\n\t\t\treturn next();\n\t\t}\n\t\tif ( count === len ) {\n\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\treturn done( null, out );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default limit;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isCollection from '@stdlib/assert-is-collection';\nimport format from '@stdlib/string-format';\nimport PINF from '@stdlib/constants-float64-pinf';\nimport validate from './validate.js';\nimport limit from './limit.js';\n\n\n// MAIN //\n\n/**\n* Returns a function which splits values into two groups according to a predicate function.\n*\n* ## Notes\n*\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {string} [options.returns=\"values\"] - if `values`, values are returned; if `indices`, indices are returned; if `*`, both indices and values are returned\n* @param {Function} predicate - predicate function specifying which group an element in the input collection belongs to\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} last argument must be a function\n* @returns {Function} function which invokes the predicate function once for each element in a collection\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* var opts = {\n* 'series': true\n* };\n*\n* // Create a `bifurcateByAsync` function which invokes the predicate function for each collection element sequentially:\n* var bifurcateByAsync = factory( opts, predicate );\n*\n* // Create a collection over which to iterate:\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* // Define a callback which handles results:\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* }\n*\n* // Try to read each element in `files`:\n* bifurcateByAsync( files, done );\n*/\nfunction factory( options, predicate ) {\n\tvar opts;\n\tvar err;\n\tvar f;\n\n\topts = {};\n\tif ( arguments.length > 1 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t\tf = predicate;\n\t} else {\n\t\tf = options;\n\t}\n\tif ( !isFunction( f ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', f ) );\n\t}\n\tif ( opts.series ) {\n\t\topts.limit = 1;\n\t} else if ( !opts.limit ) {\n\t\topts.limit = PINF;\n\t}\n\treturn bifurcateByAsync;\n\n\t/**\n\t* Invokes a predicate function for each element in a collection.\n\t*\n\t* @private\n\t* @param {Collection} collection - input collection\n\t* @param {Callback} done - function to invoke upon completion\n\t* @throws {TypeError} first argument must be a collection\n\t* @throws {TypeError} last argument must be a function\n\t* @returns {void}\n\t*/\n\tfunction bifurcateByAsync( collection, done ) {\n\t\tif ( !isCollection( collection ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a collection. Value: `%s`.', collection ) );\n\t\t}\n\t\tif ( !isFunction( done ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t\t}\n\t\treturn limit( collection, opts, f, clbk );\n\n\t\t/**\n\t\t* Callback invoked upon completion.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {Object} results - bifurcation results\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction clbk( error, results ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\tdone( null, results );\n\t\t}\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 factory from './factory.js';\n\n\n// MAIN //\n\n/**\n* Splits values into two groups according to a predicate function.\n*\n* ## Notes\n*\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Collection} collection - input collection\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {string} [options.returns=\"values\"] - if `values`, values are returned; if `indices`, indices are returned; if `*`, both indices and values are returned\n* @param {Function} predicate - predicate function specifying which group an element in the input collection belongs to\n* @param {Callback} done - function to invoke upon completion\n* @throws {TypeError} first argument must be a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} second-to-last argument must be a function\n* @throws {TypeError} last argument must be a function\n* @returns {void}\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* }\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* bifurcateByAsync( files, predicate, done );\n*/\nfunction bifurcateByAsync( collection, options, predicate, done ) {\n\tif ( arguments.length < 4 ) {\n\t\treturn factory( options )( collection, predicate );\n\t}\n\tfactory( options, predicate )( collection, done );\n}\n\n\n// EXPORTS //\n\nexport default bifurcateByAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Split values into two groups according to a predicate function.\n*\n* @module @stdlib/utils-async-bifurcate-by\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n* import bifurcateByAsync from '@stdlib/utils-async-bifurcate-by';\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* }\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* bifurcateByAsync( files, predicate, done );\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport hasOwnProp from '@stdlib/assert-has-own-property';\n\n\n// VARIABLES //\n\nvar debug = logger( 'count-by-async:limit' );\n\n\n// MAIN //\n\n/**\n* Invokes an indicator function once for each element in a collection, limiting the number of concurrently pending functions.\n*\n* @private\n* @param {Collection} collection - input collection\n* @param {Options} opts - function options\n* @param {*} [opts.thisArg] - execution context\n* @param {PositiveInteger} [opts.limit] - maximum number of pending function invocations\n* @param {Function} indicator - indicator function\n* @param {Callback} done - function to invoke upon completion or upon encountering an error\n* @returns {void}\n*/\nfunction limit( collection, opts, indicator, done ) {\n\tvar maxIndex;\n\tvar count;\n\tvar flg;\n\tvar lim;\n\tvar len;\n\tvar idx;\n\tvar out;\n\tvar i;\n\n\tlen = collection.length;\n\tdebug( 'Collection length: %d', len );\n\n\tout = {};\n\tif ( len === 0 ) {\n\t\tdebug( 'Finished processing a collection.' );\n\t\treturn done( null, out );\n\t}\n\tif ( len < opts.limit ) {\n\t\tlim = len;\n\t} else {\n\t\tlim = opts.limit;\n\t}\n\tdebug( 'Concurrency limit: %d', lim );\n\tdebug( 'Number of arguments: %d', indicator.length );\n\n\tmaxIndex = len - 1;\n\tcount = 0;\n\tidx = -1;\n\tfor ( i = 0; i < lim; i++ ) {\n\t\t// This guard is necessary to protect against synchronous functions which exhaust all collection elements...\n\t\tif ( idx < maxIndex ) {\n\t\t\tnext(); // eslint-disable-line node/callback-return\n\t\t}\n\t}\n\t/**\n\t* Callback to invoke a provided function for the next element in a collection.\n\t*\n\t* @private\n\t*/\n\tfunction next() {\n\t\tvar v;\n\t\tvar j;\n\n\t\tidx += 1;\n\t\tj = idx;\n\t\tv = collection[ j ];\n\n\t\tdebug( 'Collection element %d: %s.', j, JSON.stringify( v ) );\n\t\tif ( indicator.length === 2 ) {\n\t\t\tindicator.call( opts.thisArg, v, cb );\n\t\t} else if ( indicator.length === 3 ) {\n\t\t\tindicator.call( opts.thisArg, v, j, cb );\n\t\t} else {\n\t\t\tindicator.call( opts.thisArg, v, j, collection, cb );\n\t\t}\n\t\t/**\n\t\t* Callback invoked once a provided function finishes processing a collection element.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {*} [group] - group\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction cb( error, group ) {\n\t\t\tif ( flg ) {\n\t\t\t\t// Prevent further processing of collection elements:\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( error ) {\n\t\t\t\tflg = true;\n\t\t\t\treturn clbk( error );\n\t\t\t}\n\t\t\tdebug( 'Collection element %d group: %s.', j, group );\n\n\t\t\t// Checking for an \"own\" property is necessary to guard against the edge case where an indicator function returns a group identifier which matches a method or property on the `Object` prototype.\n\t\t\tif ( hasOwnProp( out, group ) ) {\n\t\t\t\tout[ group ] += 1;\n\t\t\t} else {\n\t\t\t\tout[ group ] = 1;\n\t\t\t}\n\t\t\tclbk();\n\t\t}\n\t}\n\n\t/**\n\t* Callback invoked once ready to process the next collection element.\n\t*\n\t* @private\n\t* @param {*} [error] - error\n\t* @returns {void}\n\t*/\n\tfunction clbk( error ) {\n\t\tif ( error ) {\n\t\t\tdebug( 'Encountered an error: %s', error.message );\n\t\t\treturn done( error );\n\t\t}\n\t\tcount += 1;\n\t\tdebug( 'Processed %d of %d collection elements.', count, len );\n\t\tif ( idx < maxIndex ) {\n\t\t\treturn next();\n\t\t}\n\t\tif ( count === len ) {\n\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\treturn done( null, out );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default limit;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isCollection from '@stdlib/assert-is-collection';\nimport format from '@stdlib/string-format';\nimport PINF from '@stdlib/constants-float64-pinf';\nimport validate from './validate.js';\nimport limit from './limit.js';\n\n\n// MAIN //\n\n/**\n* Returns a function for grouping values according to an indicator function and returns group counts.\n*\n* ## Notes\n*\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} indicator - indicator function specifying which group an element in the input collection belongs to\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} last argument must be a function\n* @returns {Function} function which invokes the indicator function once for each element in a collection\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function indicator( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, 'nonreadable' );\n* }\n* next( null, 'readable' );\n* }\n* }\n*\n* var opts = {\n* 'series': true\n* };\n*\n* // Create a `countByAsync` function which invokes the indicator function for each collection element sequentially:\n* var countByAsync = factory( opts, indicator );\n*\n* // Create a collection over which to iterate:\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* // Define a callback which handles results:\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* }\n*\n* // Try to read each element in `files`:\n* countByAsync( files, done );\n*/\nfunction factory( options, indicator ) {\n\tvar opts;\n\tvar err;\n\tvar f;\n\n\topts = {};\n\tif ( arguments.length > 1 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t\tf = indicator;\n\t} else {\n\t\tf = options;\n\t}\n\tif ( !isFunction( f ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', f ) );\n\t}\n\tif ( opts.series ) {\n\t\topts.limit = 1;\n\t} else if ( !opts.limit ) {\n\t\topts.limit = PINF;\n\t}\n\treturn countByAsync;\n\n\t/**\n\t* Invokes an indicator function for each element in a collection.\n\t*\n\t* @private\n\t* @param {Collection} collection - input collection\n\t* @param {Callback} done - function to invoke upon completion\n\t* @throws {TypeError} first argument must be a collection\n\t* @throws {TypeError} last argument must be a function\n\t* @returns {void}\n\t*/\n\tfunction countByAsync( collection, done ) {\n\t\tif ( !isCollection( collection ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a collection. Value: `%s`.', collection ) );\n\t\t}\n\t\tif ( !isFunction( done ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t\t}\n\t\treturn limit( collection, opts, f, clbk );\n\n\t\t/**\n\t\t* Callback invoked upon completion.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {Object} result - counts\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction clbk( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\tdone( null, result );\n\t\t}\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 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 isPositiveInteger } from '@stdlib/assert-is-positive-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 {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'thisArg': {},\n* 'series': false,\n* 'limit': 10\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, 'thisArg' ) ) {\n\t\topts.thisArg = options.thisArg;\n\t}\n\tif ( hasOwnProp( options, 'series' ) ) {\n\t\topts.series = options.series;\n\t\tif ( !isBoolean( opts.series ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'series', opts.series ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'limit' ) ) {\n\t\topts.limit = options.limit;\n\t\tif ( !isPositiveInteger( opts.limit ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport factory from './factory.js';\n\n\n// MAIN //\n\n/**\n* Groups values according to an indicator function and returns group counts.\n*\n* ## Notes\n*\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Collection} collection - input collection\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} indicator - indicator function specifying which group an element in the input collection belongs to\n* @param {Callback} done - function to invoke upon completion\n* @throws {TypeError} first argument must be a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} second-to-last argument must be a function\n* @throws {TypeError} last argument must be a function\n* @returns {void}\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* }\n*\n* function indicator( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, 'nonreadable' );\n* }\n* next( null, 'readable' );\n* }\n* }\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* countByAsync( files, indicator, done );\n*/\nfunction countByAsync( collection, options, indicator, done ) {\n\tif ( arguments.length < 4 ) {\n\t\treturn factory( options )( collection, indicator );\n\t}\n\tfactory( options, indicator )( collection, done );\n}\n\n\n// EXPORTS //\n\nexport default countByAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Group values according to an indicator function and return group counts.\n*\n* @module @stdlib/utils-async-count-by\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n* import countByAsync from '@stdlib/utils-async-count-by';\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* }\n*\n* function indicator( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, 'nonreadable' );\n* }\n* next( null, 'readable' );\n* }\n* }\n*\n* countByAsync( files, indicator, done );\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'every-by-async:limit' );\n\n\n// MAIN //\n\n/**\n* Invokes a predicate function once for each element in a collection, limiting the number of concurrently pending functions.\n*\n* @private\n* @param {Collection} collection - input collection\n* @param {Options} opts - function options\n* @param {*} [opts.thisArg] - execution context\n* @param {PositiveInteger} [opts.limit] - maximum number of pending function invocations\n* @param {Function} predicate - predicate function\n* @param {Callback} done - function to invoke upon completion or upon encountering an error\n* @returns {void}\n*/\nfunction limit( collection, opts, predicate, done ) {\n\tvar maxIndex;\n\tvar count;\n\tvar flg;\n\tvar lim;\n\tvar len;\n\tvar idx;\n\tvar i;\n\n\tlen = collection.length;\n\tdebug( 'Collection length: %d', len );\n\n\tif ( len === 0 ) {\n\t\tdebug( 'Finished processing a collection.' );\n\t\treturn done( null, true );\n\t}\n\tif ( len < opts.limit ) {\n\t\tlim = len;\n\t} else {\n\t\tlim = opts.limit;\n\t}\n\tdebug( 'Concurrency limit: %d', lim );\n\tdebug( 'Number of arguments: %d', predicate.length );\n\n\tmaxIndex = len - 1;\n\tcount = 0;\n\tidx = -1;\n\tfor ( i = 0; i < lim; i++ ) {\n\t\t// This guard is necessary to protect against synchronous functions which exhaust all collection elements...\n\t\tif ( idx < maxIndex ) {\n\t\t\tnext(); // eslint-disable-line node/callback-return\n\t\t}\n\t}\n\n\t/**\n\t* Callback to invoke a provided function for the next element in a collection.\n\t*\n\t* @private\n\t*/\n\tfunction next() {\n\t\tidx += 1;\n\t\tdebug( 'Collection element %d: %s.', idx, JSON.stringify( collection[ idx ] ) );\n\t\tif ( predicate.length === 2 ) {\n\t\t\tpredicate.call( opts.thisArg, collection[ idx ], clbk );\n\t\t} else if ( predicate.length === 3 ) {\n\t\t\tpredicate.call( opts.thisArg, collection[ idx ], idx, clbk );\n\t\t} else {\n\t\t\tpredicate.call( opts.thisArg, collection[ idx ], idx, collection, clbk ); // eslint-disable-line max-len\n\t\t}\n\t}\n\n\t/**\n\t* Callback invoked once a provided function finishes processing a collection element.\n\t*\n\t* @private\n\t* @param {*} [error] - error\n\t* @param {*} [result] - test result\n\t* @returns {void}\n\t*/\n\tfunction clbk( error, result ) {\n\t\tif ( flg ) {\n\t\t\t// Prevent further processing of collection elements:\n\t\t\treturn;\n\t\t}\n\t\tif ( error ) {\n\t\t\tflg = true;\n\t\t\tdebug( 'Encountered an error: %s', error.message );\n\t\t\treturn done( error );\n\t\t}\n\t\tcount += 1;\n\t\tdebug( 'Processed %d of %d collection elements.', count, len );\n\n\t\tdebug( 'Test result: %s', !!result );\n\t\tif ( !result && !flg ) {\n\t\t\tflg = true;\n\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\treturn done( null, false );\n\t\t}\n\t\tif ( idx < maxIndex ) {\n\t\t\treturn next();\n\t\t}\n\t\tif ( count === len ) {\n\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\treturn done( null, true );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default limit;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isCollection from '@stdlib/assert-is-collection';\nimport PINF from '@stdlib/constants-float64-pinf';\nimport format from '@stdlib/string-format';\nimport validate from './validate.js';\nimport limit from './limit.js';\n\n\n// MAIN //\n\n/**\n* Returns a function for testing whether all elements in a collection pass a test implemented by a predicate function.\n*\n* ## Notes\n*\n* - If a predicate function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} predicate - predicate function to invoke for each element in a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} last argument must be a function\n* @returns {Function} function which invokes the predicate function once for each element in a collection\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* var opts = {\n* 'series': true\n* };\n*\n* // Create an `everyByAsync` function which invokes the predicate function for each collection element sequentially:\n* var everyByAsync = factory( opts, predicate );\n*\n* // Create a collection over which to iterate:\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* // Define a callback which handles results:\n* function done( error, bool ) {\n* if ( error ) {\n* throw error;\n* }\n* if ( bool ) {\n* console.log( 'Successfully read all files.' );\n* } else {\n* console.log( 'Was unable to read all files.' );\n* }\n* }\n*\n* // Try to read each element in `files`:\n* everyByAsync( files, done );\n*/\nfunction factory( options, predicate ) {\n\tvar opts;\n\tvar err;\n\tvar f;\n\n\topts = {};\n\tif ( arguments.length > 1 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t\tf = predicate;\n\t} else {\n\t\tf = options;\n\t}\n\tif ( !isFunction( f ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', f ) );\n\t}\n\tif ( opts.series ) {\n\t\topts.limit = 1;\n\t} else if ( !opts.limit ) {\n\t\topts.limit = PINF;\n\t}\n\treturn everyByAsync;\n\n\t/**\n\t* Invokes a predicate function for each element in a collection.\n\t*\n\t* @private\n\t* @param {Collection} collection - input collection\n\t* @param {Callback} done - function to invoke upon completion\n\t* @throws {TypeError} first argument must be a collection\n\t* @throws {TypeError} last argument must be a function\n\t* @returns {void}\n\t*/\n\tfunction everyByAsync( collection, done ) {\n\t\tif ( !isCollection( collection ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a collection. Value: `%s`.', collection ) );\n\t\t}\n\t\tif ( !isFunction( done ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t\t}\n\t\treturn limit( collection, opts, f, clbk );\n\n\t\t/**\n\t\t* Callback invoked upon completion.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {boolean} bool - test result\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction clbk( error, bool ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error, false );\n\t\t\t}\n\t\t\tdone( null, bool );\n\t\t}\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 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 isPositiveInteger } from '@stdlib/assert-is-positive-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 {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'thisArg': {},\n* 'series': false,\n* 'limit': 10\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, 'thisArg' ) ) {\n\t\topts.thisArg = options.thisArg;\n\t}\n\tif ( hasOwnProp( options, 'series' ) ) {\n\t\topts.series = options.series;\n\t\tif ( !isBoolean( opts.series ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'series', opts.series ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'limit' ) ) {\n\t\topts.limit = options.limit;\n\t\tif ( !isPositiveInteger( opts.limit ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport factory from './factory.js';\n\n\n// MAIN //\n\n/**\n* Tests whether all elements in a collection pass a test implemented by a predicate function.\n*\n* ## Notes\n*\n* - If a predicate function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Collection} collection - input collection\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} predicate - predicate function to invoke for each element in a collection\n* @param {Callback} done - function to invoke upon completion\n* @throws {TypeError} first argument must be a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} second-to-last argument must be a function\n* @throws {TypeError} last argument must be a function\n* @returns {void}\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function done( error, bool ) {\n* if ( error ) {\n* throw error;\n* }\n* if ( bool ) {\n* console.log( 'Successfully read all files.' );\n* } else {\n* console.log( 'Was unable to read all files.' );\n* }\n* }\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* everyByAsync( files, predicate, done );\n*/\nfunction everyByAsync( collection, options, predicate, done ) {\n\tif ( arguments.length < 4 ) {\n\t\treturn factory( options )( collection, predicate );\n\t}\n\tfactory( options, predicate )( collection, done );\n}\n\n\n// EXPORTS //\n\nexport default everyByAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\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 whether all elements in a collection pass a test implemented by a predicate function.\n*\n* @module @stdlib/utils-async-every-by\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n* import everyByAsync from '@stdlib/utils-async-every-by';\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* function done( error, bool ) {\n* if ( error ) {\n* throw error;\n* }\n* if ( bool ) {\n* console.log( 'Successfully read all files.' );\n* } else {\n* console.log( 'Was unable to read all files.' );\n* }\n* }\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* everyByAsync( files, predicate, done );\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'every-by-right-async:limit' );\n\n\n// MAIN //\n\n/**\n* Invokes a predicate function once for each element in a collection, limiting the number of concurrently pending functions, and iterating from right to left.\n*\n* @private\n* @param {Collection} collection - input collection\n* @param {Options} opts - function options\n* @param {*} [opts.thisArg] - execution context\n* @param {PositiveInteger} [opts.limit] - maximum number of pending function invocations\n* @param {Function} predicate - predicate function\n* @param {Callback} done - function to invoke upon completion or upon encountering an error\n* @returns {void}\n*/\nfunction limit( collection, opts, predicate, done ) {\n\tvar count;\n\tvar flg;\n\tvar lim;\n\tvar len;\n\tvar idx;\n\tvar i;\n\n\tlen = collection.length;\n\tdebug( 'Collection length: %d', len );\n\n\tif ( len === 0 ) {\n\t\tdebug( 'Finished processing a collection.' );\n\t\treturn done( null, true );\n\t}\n\tif ( len < opts.limit ) {\n\t\tlim = len;\n\t} else {\n\t\tlim = opts.limit;\n\t}\n\tdebug( 'Concurrency limit: %d', lim );\n\tdebug( 'Number of arguments: %d', predicate.length );\n\n\tcount = 0;\n\tidx = len;\n\tfor ( i = 0; i < lim; i++ ) {\n\t\t// This guard is necessary to protect against synchronous functions which exhaust all collection elements...\n\t\tif ( idx > 0 ) {\n\t\t\tnext(); // eslint-disable-line node/callback-return\n\t\t}\n\t}\n\n\t/**\n\t* Callback to invoke a provided function for the next element in a collection.\n\t*\n\t* @private\n\t*/\n\tfunction next() {\n\t\tidx -= 1;\n\t\tdebug( 'Collection element %d: %s.', idx, JSON.stringify( collection[ idx ] ) );\n\t\tif ( predicate.length === 2 ) {\n\t\t\tpredicate.call( opts.thisArg, collection[ idx ], clbk );\n\t\t} else if ( predicate.length === 3 ) {\n\t\t\tpredicate.call( opts.thisArg, collection[ idx ], idx, clbk );\n\t\t} else {\n\t\t\tpredicate.call( opts.thisArg, collection[ idx ], idx, collection, clbk ); // eslint-disable-line max-len\n\t\t}\n\t}\n\n\t/**\n\t* Callback invoked once a provided function finishes processing a collection element.\n\t*\n\t* @private\n\t* @param {*} [error] - error\n\t* @param {*} [result] - test result\n\t* @returns {void}\n\t*/\n\tfunction clbk( error, result ) {\n\t\tif ( flg ) {\n\t\t\t// Prevent further processing of collection elements:\n\t\t\treturn;\n\t\t}\n\t\tif ( error ) {\n\t\t\tflg = true;\n\t\t\tdebug( 'Encountered an error: %s', error.message );\n\t\t\treturn done( error );\n\t\t}\n\t\tcount += 1;\n\t\tdebug( 'Processed %d of %d collection elements.', count, len );\n\n\t\tdebug( 'Test result: %s', !!result );\n\t\tif ( !result && !flg ) {\n\t\t\tflg = true;\n\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\treturn done( null, false );\n\t\t}\n\t\tif ( idx > 0 ) {\n\t\t\treturn next();\n\t\t}\n\t\tif ( count === len ) {\n\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\treturn done( null, true );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default limit;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isCollection from '@stdlib/assert-is-collection';\nimport PINF from '@stdlib/constants-float64-pinf';\nimport format from '@stdlib/string-format';\nimport validate from './validate.js';\nimport limit from './limit.js';\n\n\n// MAIN //\n\n/**\n* Returns a function for testing whether all elements in a collection pass a test implemented by a predicate function, iterating from right to left.\n*\n* ## Notes\n*\n* - If a predicate function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} predicate - predicate function to invoke for each element in a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} last argument must be a function\n* @returns {Function} function which invokes the predicate function once for each element in a collection\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* var opts = {\n* 'series': true\n* };\n*\n* // Create an `everyByRightAsync` function which invokes the predicate function for each collection element sequentially:\n* var everyByRightAsync = factory( opts, predicate );\n*\n* // Create a collection over which to iterate:\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* // Define a callback which handles results:\n* function done( error, bool ) {\n* if ( error ) {\n* throw error;\n* }\n* if ( bool ) {\n* console.log( 'Successfully read all files.' );\n* } else {\n* console.log( 'Was unable to read all files.' );\n* }\n* }\n*\n* // Try to read each element in `files`:\n* everyByRightAsync( files, done );\n*/\nfunction factory( options, predicate ) {\n\tvar opts;\n\tvar err;\n\tvar f;\n\n\topts = {};\n\tif ( arguments.length > 1 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t\tf = predicate;\n\t} else {\n\t\tf = options;\n\t}\n\tif ( !isFunction( f ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', f ) );\n\t}\n\tif ( opts.series ) {\n\t\topts.limit = 1;\n\t} else if ( !opts.limit ) {\n\t\topts.limit = PINF;\n\t}\n\treturn everyByRightAsync;\n\n\t/**\n\t* Invokes a predicate function for each element in a collection, iterating from right to left.\n\t*\n\t* @private\n\t* @param {Collection} collection - input collection\n\t* @param {Callback} done - function to invoke upon completion\n\t* @throws {TypeError} first argument must be a collection\n\t* @throws {TypeError} last argument must be a function\n\t* @returns {void}\n\t*/\n\tfunction everyByRightAsync( collection, done ) {\n\t\tif ( !isCollection( collection ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a collection. Value: `%s`.', collection ) );\n\t\t}\n\t\tif ( !isFunction( done ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t\t}\n\t\treturn limit( collection, opts, f, clbk );\n\n\t\t/**\n\t\t* Callback invoked upon completion.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {boolean} bool - test result\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction clbk( error, bool ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error, false );\n\t\t\t}\n\t\t\tdone( null, bool );\n\t\t}\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 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 isPositiveInteger } from '@stdlib/assert-is-positive-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 {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'thisArg': {},\n* 'series': false,\n* 'limit': 10\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, 'thisArg' ) ) {\n\t\topts.thisArg = options.thisArg;\n\t}\n\tif ( hasOwnProp( options, 'series' ) ) {\n\t\topts.series = options.series;\n\t\tif ( !isBoolean( opts.series ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'series', opts.series ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'limit' ) ) {\n\t\topts.limit = options.limit;\n\t\tif ( !isPositiveInteger( opts.limit ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport factory from './factory.js';\n\n\n// MAIN //\n\n/**\n* Tests whether all elements in a collection pass a test implemented by a predicate function, iterating from right to left.\n*\n* ## Notes\n*\n* - If a predicate function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Collection} collection - input collection\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} predicate - predicate function to invoke for each element in a collection\n* @param {Callback} done - function to invoke upon completion\n* @throws {TypeError} first argument must be a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} second-to-last argument must be a function\n* @throws {TypeError} last argument must be a function\n* @returns {void}\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function done( error, bool ) {\n* if ( error ) {\n* throw error;\n* }\n* if ( bool ) {\n* console.log( 'Successfully read all files.' );\n* } else {\n* console.log( 'Was unable to read all files.' );\n* }\n* }\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* everyByRightAsync( files, predicate, done );\n*/\nfunction everyByRightAsync( collection, options, predicate, done ) {\n\tif ( arguments.length < 4 ) {\n\t\treturn factory( options )( collection, predicate );\n\t}\n\tfactory( options, predicate )( collection, done );\n}\n\n\n// EXPORTS //\n\nexport default everyByRightAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\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 whether all elements in a collection pass a test implemented by a predicate function, iterating from right to left.\n*\n* @module @stdlib/utils-async-every-by-right\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n* import everyByRightAsync from '@stdlib/utils-async-every-by-right';\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* function done( error, bool ) {\n* if ( error ) {\n* throw error;\n* }\n* if ( bool ) {\n* console.log( 'Successfully read all files.' );\n* } else {\n* console.log( 'Was unable to read all files.' );\n* }\n* }\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* everyByRightAsync( files, predicate, done );\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'for-each-async:limit' );\n\n\n// MAIN //\n\n/**\n* Invokes a function once for each element in a collection, limiting the number of concurrently pending functions.\n*\n* @private\n* @param {Collection} collection - input collection\n* @param {Options} opts - function options\n* @param {*} [opts.thisArg] - execution context\n* @param {PositiveInteger} [opts.limit] - maximum number of pending function invocations\n* @param {Function} fcn - function to invoke\n* @param {Callback} done - function to invoke upon completion or upon encountering an error\n* @returns {void}\n*/\nfunction limit( collection, opts, fcn, done ) {\n\tvar maxIndex;\n\tvar count;\n\tvar flg;\n\tvar lim;\n\tvar len;\n\tvar idx;\n\tvar i;\n\n\tlen = collection.length;\n\tdebug( 'Collection length: %d', len );\n\n\tif ( len === 0 ) {\n\t\tdebug( 'Finished processing a collection.' );\n\t\treturn done();\n\t}\n\tif ( len < opts.limit ) {\n\t\tlim = len;\n\t} else {\n\t\tlim = opts.limit;\n\t}\n\tdebug( 'Concurrency limit: %d', lim );\n\tdebug( 'Number of arguments: %d', fcn.length );\n\n\tmaxIndex = len - 1;\n\tcount = 0;\n\tidx = -1;\n\tfor ( i = 0; i < lim; i++ ) {\n\t\t// This guard is necessary to protect against synchronous functions which exhaust all collection elements...\n\t\tif ( idx < maxIndex ) {\n\t\t\tnext(); // eslint-disable-line node/callback-return\n\t\t}\n\t}\n\n\t/**\n\t* Callback to invoke a provided function for the next element in a collection.\n\t*\n\t* @private\n\t*/\n\tfunction next() {\n\t\tidx += 1;\n\t\tdebug( 'Collection element %d: %s.', idx, JSON.stringify( collection[ idx ] ) );\n\t\tif ( fcn.length === 2 ) {\n\t\t\tfcn.call( opts.thisArg, collection[ idx ], clbk );\n\t\t} else if ( fcn.length === 3 ) {\n\t\t\tfcn.call( opts.thisArg, collection[ idx ], idx, clbk );\n\t\t} else {\n\t\t\tfcn.call( opts.thisArg, collection[ idx ], idx, collection, clbk );\n\t\t}\n\t}\n\n\t/**\n\t* Callback invoked once a provided function finishes processing a collection element.\n\t*\n\t* @private\n\t* @param {*} [error] - error\n\t* @returns {void}\n\t*/\n\tfunction clbk( error ) {\n\t\tif ( flg ) {\n\t\t\t// Prevent further processing of collection elements:\n\t\t\treturn;\n\t\t}\n\t\tif ( error ) {\n\t\t\tflg = true;\n\t\t\tdebug( 'Encountered an error: %s', error.message );\n\t\t\treturn done( error );\n\t\t}\n\t\tcount += 1;\n\t\tdebug( 'Processed %d of %d collection elements.', count, len );\n\t\tif ( idx < maxIndex ) {\n\t\t\treturn next();\n\t\t}\n\t\tif ( count === len ) {\n\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\treturn done();\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default limit;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isCollection from '@stdlib/assert-is-collection';\nimport format from '@stdlib/string-format';\nimport PINF from '@stdlib/constants-float64-pinf';\nimport validate from './validate.js';\nimport limit from './limit.js';\n\n\n// MAIN //\n\n/**\n* Returns a function to invoke a function once for each element in a collection.\n*\n* ## Notes\n*\n* - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} fcn - function to invoke for each element in a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} last argument must be a function\n* @returns {Function} function which invokes the provided function once for each element in a collection\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function read( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( error );\n* }\n* console.log( 'Successfully read file: %s', file );\n* next();\n* }\n* }\n*\n* var opts = {\n* 'series': true\n* };\n*\n* // Create a `forEachAsync` function which invokes `read` for each collection element sequentially:\n* var forEachAsync = factory( opts, read );\n*\n* // Create a collection over which to iterate:\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* // Define a callback which handles errors:\n* function done( error ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( 'Successfully read all files.' );\n* }\n*\n* // Run `read` for each element in `files`:\n* forEachAsync( files, done );\n*/\nfunction factory( options, fcn ) {\n\tvar opts;\n\tvar err;\n\tvar f;\n\n\topts = {};\n\tif ( arguments.length > 1 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t\tf = fcn;\n\t} else {\n\t\tf = options;\n\t}\n\tif ( !isFunction( f ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', f ) );\n\t}\n\tif ( opts.series ) {\n\t\topts.limit = 1;\n\t} else if ( !opts.limit ) {\n\t\topts.limit = PINF;\n\t}\n\treturn forEachAsync;\n\n\t/**\n\t* Invokes a function for each element in a collection.\n\t*\n\t* @private\n\t* @param {Collection} collection - input collection\n\t* @param {Callback} done - function to invoke upon completion\n\t* @throws {TypeError} first argument must be a collection\n\t* @throws {TypeError} last argument must be a function\n\t* @returns {void}\n\t*/\n\tfunction forEachAsync( collection, done ) {\n\t\tif ( !isCollection( collection ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a collection. Value: `%s`.', collection ) );\n\t\t}\n\t\tif ( !isFunction( done ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t\t}\n\t\treturn limit( collection, opts, f, clbk );\n\n\t\t/**\n\t\t* Callback invoked upon completion.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction clbk( error ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\tdone();\n\t\t}\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 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 isPositiveInteger } from '@stdlib/assert-is-positive-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 {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'thisArg': {},\n* 'series': false,\n* 'limit': 10\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, 'thisArg' ) ) {\n\t\topts.thisArg = options.thisArg;\n\t}\n\tif ( hasOwnProp( options, 'series' ) ) {\n\t\topts.series = options.series;\n\t\tif ( !isBoolean( opts.series ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'series', opts.series ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'limit' ) ) {\n\t\topts.limit = options.limit;\n\t\tif ( !isPositiveInteger( opts.limit ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport factory from './factory.js';\n\n\n// MAIN //\n\n/**\n* Invokes a function once for each element in a collection.\n*\n* ## Notes\n*\n* - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Collection} collection - input collection\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} fcn - function to invoke for each element in a collection\n* @param {Callback} done - function to invoke upon completion\n* @throws {TypeError} first argument must be a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} second-to-last argument must be a function\n* @throws {TypeError} last argument must be a function\n* @returns {void}\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function done( error ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( 'Successfully read all files.' );\n* }\n*\n* function read( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( error );\n* }\n* console.log( 'Successfully read file: %s', file );\n* next();\n* }\n* }\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* forEachAsync( files, read, done );\n*/\nfunction forEachAsync( collection, options, fcn, done ) {\n\tif ( arguments.length < 4 ) {\n\t\treturn factory( options )( collection, fcn );\n\t}\n\tfactory( options, fcn )( collection, done );\n}\n\n\n// EXPORTS //\n\nexport default forEachAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Invoke a function once for each element in a collection.\n*\n* @module @stdlib/utils-async-for-each\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n* import forEachAsync from '@stdlib/utils-async-for-each';\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* function done( error ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( 'Successfully read all files.' );\n* }\n*\n* function read( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* error = new Error( 'unable to read file: '+file );\n* return next( error );\n* }\n* console.log( 'Successfully read file: %s', file );\n* next();\n* }\n* }\n*\n* forEachAsync( files, read, done );\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'for-each-right-async:limit' );\n\n\n// MAIN //\n\n/**\n* Invokes a function once for each element in a collection, limiting the number of concurrently pending functions and iterating from right to left.\n*\n* @private\n* @param {Collection} collection - input collection\n* @param {Options} opts - function options\n* @param {*} [opts.thisArg] - execution context\n* @param {PositiveInteger} [opts.limit] - maximum number of pending function invocations\n* @param {Function} fcn - function to invoke\n* @param {Callback} done - function to invoke upon completion or upon encountering an error\n* @returns {void}\n*/\nfunction limit( collection, opts, fcn, done ) {\n\tvar count;\n\tvar flg;\n\tvar lim;\n\tvar len;\n\tvar idx;\n\tvar i;\n\n\tlen = collection.length;\n\tdebug( 'Collection length: %d', len );\n\n\tif ( len === 0 ) {\n\t\tdebug( 'Finished processing a collection.' );\n\t\treturn done();\n\t}\n\tif ( len < opts.limit ) {\n\t\tlim = len;\n\t} else {\n\t\tlim = opts.limit;\n\t}\n\tdebug( 'Concurrency limit: %d', lim );\n\tdebug( 'Number of arguments: %d', fcn.length );\n\n\tcount = 0;\n\tidx = len;\n\tfor ( i = 0; i < lim; i++ ) {\n\t\t// This guard is necessary to protect against synchronous functions which exhaust all collection elements...\n\t\tif ( idx > 0 ) {\n\t\t\tnext(); // eslint-disable-line node/callback-return\n\t\t}\n\t}\n\n\t/**\n\t* Callback to invoke a provided function for the next element in a collection.\n\t*\n\t* @private\n\t*/\n\tfunction next() {\n\t\tidx -= 1;\n\t\tdebug( 'Collection element %d: %s.', idx, JSON.stringify( collection[ idx ] ) );\n\t\tif ( fcn.length === 2 ) {\n\t\t\tfcn.call( opts.thisArg, collection[ idx ], clbk );\n\t\t} else if ( fcn.length === 3 ) {\n\t\t\tfcn.call( opts.thisArg, collection[ idx ], idx, clbk );\n\t\t} else {\n\t\t\tfcn.call( opts.thisArg, collection[ idx ], idx, collection, clbk );\n\t\t}\n\t}\n\n\t/**\n\t* Callback invoked once a provided function finishes processing a collection element.\n\t*\n\t* @private\n\t* @param {*} [error] - error\n\t* @returns {void}\n\t*/\n\tfunction clbk( error ) {\n\t\tif ( flg ) {\n\t\t\t// Prevent further processing of collection elements:\n\t\t\treturn;\n\t\t}\n\t\tif ( error ) {\n\t\t\tflg = true;\n\t\t\tdebug( 'Encountered an error: %s', error.message );\n\t\t\treturn done( error );\n\t\t}\n\t\tcount += 1;\n\t\tdebug( 'Processed %d of %d collection elements.', count, len );\n\t\tif ( idx > 0 ) {\n\t\t\treturn next();\n\t\t}\n\t\tif ( count === len ) {\n\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\treturn done();\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default limit;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isCollection from '@stdlib/assert-is-collection';\nimport format from '@stdlib/string-format';\nimport PINF from '@stdlib/constants-float64-pinf';\nimport validate from './validate.js';\nimport limit from './limit.js';\n\n\n// MAIN //\n\n/**\n* Returns a function to invoke a function once for each element in a collection, iterating from right to left.\n*\n* ## Notes\n*\n* - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} fcn - function to invoke for each element in a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} last argument must be a function\n* @returns {Function} function which invokes the provided function once for each element in a collection\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function read( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( error );\n* }\n* console.log( 'Successfully read file: %s', file );\n* next();\n* }\n* }\n*\n* var opts = {\n* 'series': true\n* };\n*\n* // Create a `forEachRightAsync` function which invokes `read` for each collection element sequentially:\n* var forEachRightAsync = factory( opts, read );\n*\n* // Create a collection over which to iterate:\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* // Define a callback which handles errors:\n* function done( error ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( 'Successfully read all files.' );\n* }\n*\n* // Run `read` for each element in `files`:\n* forEachRightAsync( files, done );\n*/\nfunction factory( options, fcn ) {\n\tvar opts;\n\tvar err;\n\tvar f;\n\n\topts = {};\n\tif ( arguments.length > 1 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t\tf = fcn;\n\t} else {\n\t\tf = options;\n\t}\n\tif ( !isFunction( f ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', f ) );\n\t}\n\tif ( opts.series ) {\n\t\topts.limit = 1;\n\t} else if ( !opts.limit ) {\n\t\topts.limit = PINF;\n\t}\n\treturn forEachRightAsync;\n\n\t/**\n\t* Invokes a function for each element in a collection, iterating from right to left.\n\t*\n\t* @private\n\t* @param {Collection} collection - input collection\n\t* @param {Callback} done - function to invoke upon completion\n\t* @throws {TypeError} first argument must be a collection\n\t* @throws {TypeError} last argument must be a function\n\t* @returns {void}\n\t*/\n\tfunction forEachRightAsync( collection, done ) {\n\t\tif ( !isCollection( collection ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a collection. Value: `%s`.', collection ) );\n\t\t}\n\t\tif ( !isFunction( done ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t\t}\n\t\treturn limit( collection, opts, f, clbk );\n\n\t\t/**\n\t\t* Callback invoked upon completion.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction clbk( error ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\tdone();\n\t\t}\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 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 isPositiveInteger } from '@stdlib/assert-is-positive-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 {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'thisArg': {},\n* 'series': false,\n* 'limit': 10\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, 'thisArg' ) ) {\n\t\topts.thisArg = options.thisArg;\n\t}\n\tif ( hasOwnProp( options, 'series' ) ) {\n\t\topts.series = options.series;\n\t\tif ( !isBoolean( opts.series ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'series', opts.series ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'limit' ) ) {\n\t\topts.limit = options.limit;\n\t\tif ( !isPositiveInteger( opts.limit ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport factory from './factory.js';\n\n\n// MAIN //\n\n/**\n* Invokes a function once for each element in a collection, iterating from right to left.\n*\n* ## Notes\n*\n* - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Collection} collection - input collection\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} fcn - function to invoke for each element in a collection\n* @param {Callback} done - function to invoke upon completion\n* @throws {TypeError} first argument must be a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} second-to-last argument must be a function\n* @throws {TypeError} last argument must be a function\n* @returns {void}\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function done( error ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( 'Successfully read all files.' );\n* }\n*\n* function read( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( error );\n* }\n* console.log( 'Successfully read file: %s', file );\n* next();\n* }\n* }\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* forEachRightAsync( files, read, done );\n*/\nfunction forEachRightAsync( collection, options, fcn, done ) {\n\tif ( arguments.length < 4 ) {\n\t\treturn factory( options )( collection, fcn );\n\t}\n\tfactory( options, fcn )( collection, done );\n}\n\n\n// EXPORTS //\n\nexport default forEachRightAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Invoke a function once for each element in a collection, iterating from right to left.\n*\n* @module @stdlib/utils-async-for-each-right\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n* import forEachRightAsync from '@stdlib/utils-async-for-each-right';\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* function done( error ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( 'Successfully read all files.' );\n* }\n*\n* function read( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* error = new Error( 'unable to read file: '+file );\n* return next( error );\n* }\n* console.log( 'Successfully read file: %s', file );\n* next();\n* }\n* }\n*\n* forEachRightAsync( files, read, done );\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport 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 isPositiveInteger } from '@stdlib/assert-is-positive-integer';\nimport indexOf from '@stdlib/utils-index-of';\nimport format from '@stdlib/string-format';\n\n\n// VARIABLES //\n\nvar returns = [ 'values', 'indices', '*' ];\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 {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {string} [options.returns] - output format\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'thisArg': {},\n* 'series': false,\n* 'limit': 10,\n* 'returns': '*'\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, 'thisArg' ) ) {\n\t\topts.thisArg = options.thisArg;\n\t}\n\tif ( hasOwnProp( options, 'series' ) ) {\n\t\topts.series = options.series;\n\t\tif ( !isBoolean( opts.series ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'series', opts.series ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'limit' ) ) {\n\t\topts.limit = options.limit;\n\t\tif ( !isPositiveInteger( opts.limit ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'returns' ) ) {\n\t\topts.returns = options.returns;\n\t\tif ( indexOf( returns, opts.returns ) === -1 ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be one of the following: \"%s\". Option: `%s`.', 'returns', returns.join( '\", \"' ), opts.returns ) );\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 hasOwnProp from '@stdlib/assert-has-own-property';\n\n\n// VARIABLES //\n\nvar debug = logger( 'group-by-async:limit' );\n\n\n// MAIN //\n\n/**\n* Invokes an indicator function once for each element in a collection, limiting the number of concurrently pending functions.\n*\n* ## Notes\n*\n* - We need to cache the collection value to prevent the edge case where, during the invocation of the indicator function, the element at index `i` is swapped for some other value. For some, that might be a feature; here, we take the stance that one should be less clever.\n* - Checking for an \"own\" property is necessary to guard against the edge case where an indicator function returns a group identifier which matches a method or property on the `Object` prototype.\n*\n* @private\n* @param {Collection} collection - input collection\n* @param {Options} opts - function options\n* @param {*} [opts.thisArg] - execution context\n* @param {PositiveInteger} [opts.limit] - maximum number of pending function invocations\n* @param {string} [options.returns] - output format\n* @param {Function} indicator - indicator function\n* @param {Callback} done - function to invoke upon completion or upon encountering an error\n* @returns {void}\n*/\nfunction limit( collection, opts, indicator, done ) {\n\tvar maxIndex;\n\tvar count;\n\tvar flg;\n\tvar lim;\n\tvar len;\n\tvar idx;\n\tvar out;\n\tvar i;\n\n\tlen = collection.length;\n\tdebug( 'Collection length: %d', len );\n\n\tout = {};\n\tif ( len === 0 ) {\n\t\tdebug( 'Finished processing a collection.' );\n\t\treturn done( null, out );\n\t}\n\tif ( len < opts.limit ) {\n\t\tlim = len;\n\t} else {\n\t\tlim = opts.limit;\n\t}\n\tdebug( 'Concurrency limit: %d', lim );\n\tdebug( 'Number of arguments: %d', indicator.length );\n\n\tmaxIndex = len - 1;\n\tcount = 0;\n\tidx = -1;\n\tfor ( i = 0; i < lim; i++ ) {\n\t\t// This guard is necessary to protect against synchronous functions which exhaust all collection elements...\n\t\tif ( idx < maxIndex ) {\n\t\t\tnext(); // eslint-disable-line node/callback-return\n\t\t}\n\t}\n\t/**\n\t* Callback to invoke a provided function for the next element in a collection.\n\t*\n\t* @private\n\t*/\n\tfunction next() {\n\t\tvar v;\n\t\tvar j;\n\n\t\tidx += 1;\n\t\tj = idx;\n\t\tv = collection[ j ];\n\n\t\tdebug( 'Collection element %d: %s.', j, JSON.stringify( v ) );\n\t\tif ( indicator.length === 2 ) {\n\t\t\tindicator.call( opts.thisArg, v, cb );\n\t\t} else if ( indicator.length === 3 ) {\n\t\t\tindicator.call( opts.thisArg, v, j, cb );\n\t\t} else {\n\t\t\tindicator.call( opts.thisArg, v, j, collection, cb );\n\t\t}\n\t\t/**\n\t\t* Callback invoked once a provided function finishes processing a collection element.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {*} [group] - group\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction cb( error, group ) {\n\t\t\tif ( flg ) {\n\t\t\t\t// Prevent further processing of collection elements:\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( error ) {\n\t\t\t\tflg = true;\n\t\t\t\treturn clbk( error );\n\t\t\t}\n\t\t\tdebug( 'Collection element %d group: %s.', j, group );\n\n\t\t\t// Default is to return values...\n\t\t\tif ( opts.returns === 'indices' ) {\n\t\t\t\tif ( hasOwnProp( out, group ) ) {\n\t\t\t\t\tout[ group ].push( j );\n\t\t\t\t} else {\n\t\t\t\t\tout[ group ] = [ j ];\n\t\t\t\t}\n\t\t\t} else if ( opts.returns === '*' ) {\n\t\t\t\tif ( hasOwnProp( out, group ) ) {\n\t\t\t\t\tout[ group ].push( [ j, v ] );\n\t\t\t\t} else {\n\t\t\t\t\tout[ group ] = [ [ j, v ] ];\n\t\t\t\t}\n\t\t\t} else if ( hasOwnProp( out, group ) ) {\n\t\t\t\tout[ group ].push( v );\n\t\t\t} else {\n\t\t\t\tout[ group ] = [ v ];\n\t\t\t}\n\t\t\tclbk();\n\t\t}\n\t}\n\n\t/**\n\t* Callback invoked once ready to process the next collection element.\n\t*\n\t* @private\n\t* @param {*} [error] - error\n\t* @returns {void}\n\t*/\n\tfunction clbk( error ) {\n\t\tif ( error ) {\n\t\t\tdebug( 'Encountered an error: %s', error.message );\n\t\t\treturn done( error );\n\t\t}\n\t\tcount += 1;\n\t\tdebug( 'Processed %d of %d collection elements.', count, len );\n\t\tif ( idx < maxIndex ) {\n\t\t\treturn next();\n\t\t}\n\t\tif ( count === len ) {\n\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\treturn done( null, out );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default limit;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isCollection from '@stdlib/assert-is-collection';\nimport format from '@stdlib/string-format';\nimport PINF from '@stdlib/constants-float64-pinf';\nimport validate from './validate.js';\nimport limit from './limit.js';\n\n\n// MAIN //\n\n/**\n* Returns a function for grouping values according to an indicator function.\n*\n* ## Notes\n*\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {string} [options.returns=\"values\"] - if `values`, values are returned; if `indices`, indices are returned; if `*`, both indices and values are returned\n* @param {Function} indicator - indicator function specifying which group an element in the input collection belongs to\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} last argument must be a function\n* @returns {Function} function which invokes the indicator function once for each element in a collection\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function indicator( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, 'nonreadable' );\n* }\n* next( null, 'readable' );\n* }\n* }\n*\n* var opts = {\n* 'series': true\n* };\n*\n* // Create a `groupByAsync` function which invokes the indicator function for each collection element sequentially:\n* var groupByAsync = factory( opts, indicator );\n*\n* // Create a collection over which to iterate:\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* // Define a callback which handles results:\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* }\n*\n* // Try to read each element in `files`:\n* groupByAsync( files, done );\n*/\nfunction factory( options, indicator ) {\n\tvar opts;\n\tvar err;\n\tvar f;\n\n\topts = {};\n\tif ( arguments.length > 1 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t\tf = indicator;\n\t} else {\n\t\tf = options;\n\t}\n\tif ( !isFunction( f ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', f ) );\n\t}\n\tif ( opts.series ) {\n\t\topts.limit = 1;\n\t} else if ( !opts.limit ) {\n\t\topts.limit = PINF;\n\t}\n\treturn groupByAsync;\n\n\t/**\n\t* Invokes an indicator function for each element in a collection.\n\t*\n\t* @private\n\t* @param {Collection} collection - input collection\n\t* @param {Callback} done - function to invoke upon completion\n\t* @throws {TypeError} first argument must be a collection\n\t* @throws {TypeError} last argument must be a function\n\t* @returns {void}\n\t*/\n\tfunction groupByAsync( collection, done ) {\n\t\tif ( !isCollection( collection ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a collection. Value: `%s`.', collection ) );\n\t\t}\n\t\tif ( !isFunction( done ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t\t}\n\t\treturn limit( collection, opts, f, clbk );\n\n\t\t/**\n\t\t* Callback invoked upon completion.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {Object} result - group-by result\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction clbk( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\tdone( null, result );\n\t\t}\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 factory from './factory.js';\n\n\n// MAIN //\n\n/**\n* Groups values according to an indicator function.\n*\n* ## Notes\n*\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Collection} collection - input collection\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {string} [options.returns=\"values\"] - if `values`, values are returned; if `indices`, indices are returned; if `*`, both indices and values are returned\n* @param {Function} indicator - indicator function specifying which group an element in the input collection belongs to\n* @param {Callback} done - function to invoke upon completion\n* @throws {TypeError} first argument must be a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} second-to-last argument must be a function\n* @throws {TypeError} last argument must be a function\n* @returns {void}\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* }\n*\n* function indicator( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, 'nonreadable' );\n* }\n* next( null, 'readable' );\n* }\n* }\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* groupByAsync( files, indicator, done );\n*/\nfunction groupByAsync( collection, options, indicator, done ) {\n\tif ( arguments.length < 4 ) {\n\t\treturn factory( options )( collection, indicator );\n\t}\n\tfactory( options, indicator )( collection, done );\n}\n\n\n// EXPORTS //\n\nexport default groupByAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Group values according to an indicator function.\n*\n* @module @stdlib/utils-async-group-by\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n* import groupByAsync from '@stdlib/utils-async-group-by';\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* }\n*\n* function indicator( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, 'nonreadable' );\n* }\n* next( null, 'readable' );\n* }\n* }\n*\n* groupByAsync( files, indicator, done );\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'inmap-async:limit' );\n\n\n// MAIN //\n\n/**\n* Invokes a function once for each element in a collection, limiting the number of concurrently pending functions, and updates a collection in-place.\n*\n* @private\n* @param {Collection} collection - input collection\n* @param {Options} opts - function options\n* @param {*} [opts.thisArg] - execution context\n* @param {PositiveInteger} [opts.limit] - maximum number of pending function invocations\n* @param {Function} fcn - function to invoke\n* @param {Callback} done - function to invoke upon completion or upon encountering an error\n* @returns {void}\n*/\nfunction limit( collection, opts, fcn, done ) {\n\tvar maxIndex;\n\tvar count;\n\tvar flg;\n\tvar lim;\n\tvar len;\n\tvar idx;\n\tvar i;\n\n\tlen = collection.length;\n\tdebug( 'Collection length: %d', len );\n\n\tif ( len === 0 ) {\n\t\tdebug( 'Finished processing a collection.' );\n\t\treturn done();\n\t}\n\tif ( len < opts.limit ) {\n\t\tlim = len;\n\t} else {\n\t\tlim = opts.limit;\n\t}\n\tdebug( 'Concurrency limit: %d', lim );\n\tdebug( 'Number of arguments: %d', fcn.length );\n\n\tmaxIndex = len - 1;\n\tcount = 0;\n\tidx = -1;\n\tfor ( i = 0; i < lim; i++ ) {\n\t\t// This guard is necessary to protect against synchronous functions which exhaust all collection elements...\n\t\tif ( idx < maxIndex ) {\n\t\t\tnext(); // eslint-disable-line node/callback-return\n\t\t}\n\t}\n\t/**\n\t* Callback to invoke a provided function for the next element in a collection.\n\t*\n\t* @private\n\t*/\n\tfunction next() {\n\t\tvar j;\n\t\tidx += 1;\n\t\tj = idx;\n\t\tdebug( 'Collection element %d: %s.', j, JSON.stringify( collection[ j ] ) );\n\t\tif ( fcn.length === 2 ) {\n\t\t\tfcn.call( opts.thisArg, collection[ j ], cb );\n\t\t} else if ( fcn.length === 3 ) {\n\t\t\tfcn.call( opts.thisArg, collection[ j ], j, cb );\n\t\t} else {\n\t\t\tfcn.call( opts.thisArg, collection[ j ], j, collection, cb );\n\t\t}\n\t\t/**\n\t\t* Callback invoked once a provided function finishes processing a collection element.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {*} [result] - result\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction cb( error, result ) {\n\t\t\tif ( flg ) {\n\t\t\t\t// Prevent further processing of collection elements:\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( error ) {\n\t\t\t\tflg = true;\n\t\t\t\treturn clbk( error );\n\t\t\t}\n\t\t\tcollection[ j ] = result;\n\t\t\tclbk();\n\t\t}\n\t}\n\n\t/**\n\t* Callback invoked once ready to process the next collection element.\n\t*\n\t* @private\n\t* @param {*} [error] - error\n\t* @returns {void}\n\t*/\n\tfunction clbk( error ) {\n\t\tif ( error ) {\n\t\t\tdebug( 'Encountered an error: %s', error.message );\n\t\t\treturn done( error );\n\t\t}\n\t\tcount += 1;\n\t\tdebug( 'Processed %d of %d collection elements.', count, len );\n\t\tif ( idx < maxIndex ) {\n\t\t\treturn next();\n\t\t}\n\t\tif ( count === len ) {\n\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\treturn done();\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default limit;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isCollection from '@stdlib/assert-is-collection';\nimport format from '@stdlib/string-format';\nimport PINF from '@stdlib/constants-float64-pinf';\nimport validate from './validate.js';\nimport limit from './limit.js';\n\n\n// MAIN //\n\n/**\n* Returns a function to invoke a function once for each element in a collection and to update the collection in-place.\n*\n* ## Notes\n*\n* - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling. Note, however, that the function may have mutated an input collection during prior invocations, resulting in a partially mutated collection.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} fcn - function to invoke for each element in a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} last argument must be a function\n* @returns {Function} function which invokes the provided function once for each element in a collection\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function read( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error, data ) {\n* if ( error ) {\n* return next( error );\n* }\n* next( null, data );\n* }\n* }\n*\n* var opts = {\n* 'series': true\n* };\n*\n* // Create a `inmapAsync` function which invokes `read` for each collection element sequentially:\n* var inmapAsync = factory( opts, read );\n*\n* // Create a collection over which to iterate:\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* // Define a callback which handles errors:\n* function done( error, results ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( results );\n* }\n*\n* // Run `read` for each element in `files`:\n* inmapAsync( files, done );\n*/\nfunction factory( options, fcn ) {\n\tvar opts;\n\tvar err;\n\tvar f;\n\n\topts = {};\n\tif ( arguments.length > 1 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t\tf = fcn;\n\t} else {\n\t\tf = options;\n\t}\n\tif ( !isFunction( f ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', f ) );\n\t}\n\tif ( opts.series ) {\n\t\topts.limit = 1;\n\t} else if ( !opts.limit ) {\n\t\topts.limit = PINF;\n\t}\n\treturn inmapAsync;\n\n\t/**\n\t* Invokes a function for each element in a collection and updates a collection in-place.\n\t*\n\t* @private\n\t* @param {Collection} collection - input collection\n\t* @param {Callback} done - function to invoke upon completion\n\t* @throws {TypeError} first argument must be a collection\n\t* @throws {TypeError} last argument must be a function\n\t* @returns {void}\n\t*/\n\tfunction inmapAsync( collection, done ) {\n\t\tif ( !isCollection( collection ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a collection. Value: `%s`.', collection ) );\n\t\t}\n\t\tif ( !isFunction( done ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t\t}\n\t\treturn limit( collection, opts, f, clbk );\n\n\t\t/**\n\t\t* Callback invoked upon completion.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction clbk( error ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error, collection );\n\t\t\t}\n\t\t\tdone( null, collection );\n\t\t}\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 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 isPositiveInteger } from '@stdlib/assert-is-positive-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 {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'thisArg': {},\n* 'series': false,\n* 'limit': 10\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, 'thisArg' ) ) {\n\t\topts.thisArg = options.thisArg;\n\t}\n\tif ( hasOwnProp( options, 'series' ) ) {\n\t\topts.series = options.series;\n\t\tif ( !isBoolean( opts.series ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'series', opts.series ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'limit' ) ) {\n\t\topts.limit = options.limit;\n\t\tif ( !isPositiveInteger( opts.limit ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport factory from './factory.js';\n\n\n// MAIN //\n\n/**\n* Invokes a function once for each element in a collection and updates a collection in-place.\n*\n* ## Notes\n*\n* - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling. Note, however, that the function may have mutated an input collection during prior invocations, resulting in a partially mutated collection.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Collection} collection - input collection\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} fcn - function to invoke for each element in a collection\n* @param {Callback} done - function to invoke upon completion\n* @throws {TypeError} first argument must be a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} second-to-last argument must be a function\n* @throws {TypeError} last argument must be a function\n* @returns {void}\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function done( error, results ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( results );\n* }\n*\n* function read( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error, data ) {\n* if ( error ) {\n* return next( error );\n* }\n* next( null, data );\n* }\n* }\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* inmapAsync( files, read, done );\n*/\nfunction inmapAsync( collection, options, fcn, done ) {\n\tif ( arguments.length < 4 ) {\n\t\treturn factory( options )( collection, fcn );\n\t}\n\tfactory( options, fcn )( collection, done );\n}\n\n\n// EXPORTS //\n\nexport default inmapAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Invoke a function once for each element in a collection and update a collection in-place.\n*\n* @module @stdlib/utils-async-inmap\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n* import inmapAsync from '@stdlib/utils-async-inmap';\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* function done( error, results ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( results );\n* }\n*\n* function read( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error, data ) {\n* if ( error ) {\n* error = new Error( 'unable to read file: '+file );\n* return next( error );\n* }\n* next( null, data );\n* }\n* }\n*\n* inmapAsync( files, read, done );\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'inmap-right-async:limit' );\n\n\n// MAIN //\n\n/**\n* Invokes a function once for each element in a collection, limiting the number of concurrently pending functions and iterating from right to left, and updates a collection in-place.\n*\n* @private\n* @param {Collection} collection - input collection\n* @param {Options} opts - function options\n* @param {*} [opts.thisArg] - execution context\n* @param {PositiveInteger} [opts.limit] - maximum number of pending function invocations\n* @param {Function} fcn - function to invoke\n* @param {Callback} done - function to invoke upon completion or upon encountering an error\n* @returns {void}\n*/\nfunction limit( collection, opts, fcn, done ) {\n\tvar count;\n\tvar flg;\n\tvar lim;\n\tvar len;\n\tvar idx;\n\tvar i;\n\n\tlen = collection.length;\n\tdebug( 'Collection length: %d', len );\n\n\tif ( len === 0 ) {\n\t\tdebug( 'Finished processing a collection.' );\n\t\treturn done();\n\t}\n\tif ( len < opts.limit ) {\n\t\tlim = len;\n\t} else {\n\t\tlim = opts.limit;\n\t}\n\tdebug( 'Concurrency limit: %d', lim );\n\tdebug( 'Number of arguments: %d', fcn.length );\n\n\tcount = 0;\n\tidx = len;\n\tfor ( i = 0; i < lim; i++ ) {\n\t\t// This guard is necessary to protect against synchronous functions which exhaust all collection elements...\n\t\tif ( idx > 0 ) {\n\t\t\tnext(); // eslint-disable-line node/callback-return\n\t\t}\n\t}\n\t/**\n\t* Callback to invoke a provided function for the next element in a collection.\n\t*\n\t* @private\n\t*/\n\tfunction next() {\n\t\tvar j;\n\t\tidx -= 1;\n\t\tj = idx;\n\t\tdebug( 'Collection element %d: %s.', j, JSON.stringify( collection[ j ] ) );\n\t\tif ( fcn.length === 2 ) {\n\t\t\tfcn.call( opts.thisArg, collection[ j ], cb );\n\t\t} else if ( fcn.length === 3 ) {\n\t\t\tfcn.call( opts.thisArg, collection[ j ], j, cb );\n\t\t} else {\n\t\t\tfcn.call( opts.thisArg, collection[ j ], j, collection, cb );\n\t\t}\n\t\t/**\n\t\t* Callback invoked once a provided function finishes processing a collection element.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {*} [result] - result\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction cb( error, result ) {\n\t\t\tif ( flg ) {\n\t\t\t\t// Prevent further processing of collection elements:\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( error ) {\n\t\t\t\tflg = true;\n\t\t\t\treturn clbk( error );\n\t\t\t}\n\t\t\tcollection[ j ] = result;\n\t\t\tclbk();\n\t\t}\n\t}\n\n\t/**\n\t* Callback invoked once ready to process the next collection element.\n\t*\n\t* @private\n\t* @param {*} [error] - error\n\t* @returns {void}\n\t*/\n\tfunction clbk( error ) {\n\t\tif ( error ) {\n\t\t\tdebug( 'Encountered an error: %s', error.message );\n\t\t\treturn done( error );\n\t\t}\n\t\tcount += 1;\n\t\tdebug( 'Processed %d of %d collection elements.', count, len );\n\t\tif ( idx > 0 ) {\n\t\t\treturn next();\n\t\t}\n\t\tif ( count === len ) {\n\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\treturn done();\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default limit;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isCollection from '@stdlib/assert-is-collection';\nimport format from '@stdlib/string-format';\nimport PINF from '@stdlib/constants-float64-pinf';\nimport validate from './validate.js';\nimport limit from './limit.js';\n\n\n// MAIN //\n\n/**\n* Returns a function to invoke a function once for each element in a collection and to update the collection in-place, iterating from right to left.\n*\n* ## Notes\n*\n* - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling. Note, however, that the function may have mutated an input collection during prior invocations, resulting in a partially mutated collection.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} fcn - function to invoke for each element in a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} last argument must be a function\n* @returns {Function} function which invokes the provided function once for each element in a collection\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function read( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error, data ) {\n* if ( error ) {\n* return next( error );\n* }\n* next( null, data );\n* }\n* }\n*\n* var opts = {\n* 'series': true\n* };\n*\n* // Create a `inmapRightAsync` function which invokes `read` for each collection element sequentially:\n* var inmapRightAsync = factory( opts, read );\n*\n* // Create a collection over which to iterate:\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* // Define a callback which handles errors:\n* function done( error, results ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( results );\n* }\n*\n* // Run `read` for each element in `files`:\n* inmapRightAsync( files, done );\n*/\nfunction factory( options, fcn ) {\n\tvar opts;\n\tvar err;\n\tvar f;\n\n\topts = {};\n\tif ( arguments.length > 1 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t\tf = fcn;\n\t} else {\n\t\tf = options;\n\t}\n\tif ( !isFunction( f ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', f ) );\n\t}\n\tif ( opts.series ) {\n\t\topts.limit = 1;\n\t} else if ( !opts.limit ) {\n\t\topts.limit = PINF;\n\t}\n\treturn inmapRightAsync;\n\n\t/**\n\t* Invokes a function for each element in a collection and updates a collection in-place, iterating from right to left.\n\t*\n\t* @private\n\t* @param {Collection} collection - input collection\n\t* @param {Callback} done - function to invoke upon completion\n\t* @throws {TypeError} first argument must be a collection\n\t* @throws {TypeError} last argument must be a function\n\t* @returns {void}\n\t*/\n\tfunction inmapRightAsync( collection, done ) {\n\t\tif ( !isCollection( collection ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a collection. Value: `%s`.', collection ) );\n\t\t}\n\t\tif ( !isFunction( done ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t\t}\n\t\treturn limit( collection, opts, f, clbk );\n\n\t\t/**\n\t\t* Callback invoked upon completion.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction clbk( error ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error, collection );\n\t\t\t}\n\t\t\tdone( null, collection );\n\t\t}\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 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 isPositiveInteger } from '@stdlib/assert-is-positive-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 {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'thisArg': {},\n* 'series': false,\n* 'limit': 10\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, 'thisArg' ) ) {\n\t\topts.thisArg = options.thisArg;\n\t}\n\tif ( hasOwnProp( options, 'series' ) ) {\n\t\topts.series = options.series;\n\t\tif ( !isBoolean( opts.series ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'series', opts.series ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'limit' ) ) {\n\t\topts.limit = options.limit;\n\t\tif ( !isPositiveInteger( opts.limit ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport factory from './factory.js';\n\n\n// MAIN //\n\n/**\n* Invokes a function once for each element in a collection and updates a collection in-place, iterating from right to left.\n*\n* ## Notes\n*\n* - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling. Note, however, that the function may have mutated an input collection during prior invocations, resulting in a partially mutated collection.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Collection} collection - input collection\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} fcn - function to invoke for each element in a collection\n* @param {Callback} done - function to invoke upon completion\n* @throws {TypeError} first argument must be a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} second-to-last argument must be a function\n* @throws {TypeError} last argument must be a function\n* @returns {void}\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function done( error, results ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( results );\n* }\n*\n* function read( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error, data ) {\n* if ( error ) {\n* return next( error );\n* }\n* next( null, data );\n* }\n* }\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* inmapRightAsync( files, read, done );\n*/\nfunction inmapRightAsync( collection, options, fcn, done ) {\n\tif ( arguments.length < 4 ) {\n\t\treturn factory( options )( collection, fcn );\n\t}\n\tfactory( options, fcn )( collection, done );\n}\n\n\n// EXPORTS //\n\nexport default inmapRightAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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* Invoke a function once for each element in a collection and update a collection in-place, iterating from right to left.\n*\n* @module @stdlib/utils-async-inmap-right\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n* import inmapRightAsync from '@stdlib/utils-async-inmap-right';\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* function done( error, results ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( results );\n* }\n*\n* function read( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error, data ) {\n* if ( error ) {\n* error = new Error( 'unable to read file: '+file );\n* return next( error );\n* }\n* next( null, data );\n* }\n* }\n*\n* inmapRightAsync( files, read, done );\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\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// VARIABLES //\n\nvar debug = logger( 'map-function-async:limit' );\n\n\n// MAIN //\n\n/**\n* Invokes a function `n` times, limiting the number of concurrently pending invocations, and returns an array of accumulated function return values.\n*\n* @private\n* @param {NonNegativeInteger} n - number of function invocations\n* @param {Options} opts - function options\n* @param {*} [opts.thisArg] - execution context\n* @param {PositiveInteger} [opts.limit] - maximum number of pending function invocations\n* @param {Function} fcn - function to invoke\n* @param {Callback} done - function to invoke upon completion or upon encountering an error\n* @returns {void}\n*/\nfunction limit( n, opts, fcn, done ) {\n\tvar count;\n\tvar flg;\n\tvar out;\n\tvar lim;\n\tvar idx;\n\tvar m;\n\tvar i;\n\n\tdebug( 'Number of invocations: %d', n );\n\n\t// Note: we explicitly preallocate in order to facilitate inserting a function result into its associated output array index. This means we do not ensure \"fast\" elements for large output arrays.\n\tout = new Array( n );\n\tif ( n === 0 ) {\n\t\tdebug( 'Finished invoking a function.' );\n\t\treturn done( null, out );\n\t}\n\tif ( n < opts.limit ) {\n\t\tlim = n;\n\t} else {\n\t\tlim = opts.limit;\n\t}\n\tdebug( 'Concurrency limit: %d', lim );\n\n\tcount = 0;\n\tidx = -1;\n\tm = n - 1;\n\tfor ( i = 0; i < lim; i++ ) {\n\t\t// This guard is necessary to protect against synchronous functions which exhaust all invocations...\n\t\tif ( idx < m ) {\n\t\t\tnext(); // eslint-disable-line node/callback-return\n\t\t}\n\t}\n\t/**\n\t* Callback to process the next function invocation.\n\t*\n\t* @private\n\t*/\n\tfunction next() {\n\t\tvar j;\n\t\tidx += 1;\n\t\tj = idx;\n\t\tdebug( 'Invocation number: %d', j );\n\t\tfcn.call( opts.thisArg, j, cb );\n\n\t\t/**\n\t\t* Callback invoked once a provided function completes.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {*} [result] - result\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction cb( error, result ) {\n\t\t\tif ( flg ) {\n\t\t\t\t// Prevent further invocations:\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( error ) {\n\t\t\t\tflg = true;\n\t\t\t\treturn clbk( error );\n\t\t\t}\n\t\t\tout[ j ] = result;\n\t\t\tclbk();\n\t\t}\n\t}\n\n\t/**\n\t* Callback invoked once ready to process the next invocation.\n\t*\n\t* @private\n\t* @param {*} [error] - error\n\t* @returns {void}\n\t*/\n\tfunction clbk( error ) {\n\t\tif ( error ) {\n\t\t\tdebug( 'Encountered an error: %s', error.message );\n\t\t\treturn done( error );\n\t\t}\n\t\tcount += 1;\n\t\tdebug( 'Completed invocation %d of %d.', count, n );\n\t\tif ( idx < m ) {\n\t\t\treturn next();\n\t\t}\n\t\tif ( count === n ) {\n\t\t\tdebug( 'Finished invoking a function.' );\n\t\t\treturn done( null, out );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default limit;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isFunction from '@stdlib/assert-is-function';\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert-is-nonnegative-integer';\nimport format from '@stdlib/string-format';\nimport PINF from '@stdlib/constants-float64-pinf';\nimport validate from './validate.js';\nimport limit from './limit.js';\n\n\n// MAIN //\n\n/**\n* Returns a function to invoke a function `n` times and return an array of accumulated function return values.\n*\n* ## Notes\n*\n* - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function again\n* @param {Function} fcn - function to invoke\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} last argument must be a function\n* @returns {Function} function which invokes a function `n` times and returns an array of accumulated function return values\n*\n* @example\n* function fcn( i, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, i );\n* }\n* }\n*\n* var opts = {\n* 'series': true\n* };\n*\n* var mapFunAsync = factory( opts, fcn );\n*\n* function done( error, results ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( results );\n* }\n*\n* mapFunAsync( 10, done );\n*/\nfunction factory( options, fcn ) {\n\tvar opts;\n\tvar err;\n\tvar f;\n\n\topts = {};\n\tif ( arguments.length > 1 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t\tf = fcn;\n\t} else {\n\t\tf = options;\n\t}\n\tif ( !isFunction( f ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', f ) );\n\t}\n\tif ( opts.series ) {\n\t\topts.limit = 1;\n\t} else if ( !opts.limit ) {\n\t\topts.limit = PINF;\n\t}\n\treturn mapFunAsync;\n\n\t/**\n\t* Invokes a function `n` times and returns an array of accumulated function return values.\n\t*\n\t* @private\n\t* @param {NonNegativeInteger} n - number of function invocations\n\t* @param {Callback} done - function to invoke upon completion\n\t* @throws {TypeError} first argument must be a nonnegative integer\n\t* @throws {TypeError} last argument must be a function\n\t* @returns {void}\n\t*/\n\tfunction mapFunAsync( n, done ) {\n\t\tif ( !isNonNegativeInteger( n ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Number of function invocations must be a nonnegative integer. Value: `%s`.', n ) );\n\t\t}\n\t\tif ( !isFunction( done ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t\t}\n\t\treturn limit( n, opts, f, clbk );\n\n\t\t/**\n\t\t* Callback invoked upon completion.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {Array} results - results\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction clbk( error, results ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\tdone( null, results );\n\t\t}\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 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 isPositiveInteger } from '@stdlib/assert-is-positive-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 {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series] - boolean indicating whether to wait for a previous invocation to complete before the next invocation\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'thisArg': {},\n* 'series': false,\n* 'limit': 10\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, 'thisArg' ) ) {\n\t\topts.thisArg = options.thisArg;\n\t}\n\tif ( hasOwnProp( options, 'series' ) ) {\n\t\topts.series = options.series;\n\t\tif ( !isBoolean( opts.series ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'series', opts.series ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'limit' ) ) {\n\t\topts.limit = options.limit;\n\t\tif ( !isPositiveInteger( opts.limit ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport factory from './factory.js';\n\n\n// MAIN //\n\n/**\n* Invokes a function `n` times and returns an array of accumulated function return values.\n*\n* ## Notes\n*\n* - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Function} fcn - function to invoke\n* @param {NonNegativeInteger} n - number of function invocations\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function again\n* @param {Function} done - callback to invoke upon invoking a function `n` times\n* @throws {TypeError} first argument must be a function\n* @throws {TypeError} second argument must be a nonnegative integer\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} last argument must be a function\n* @returns {void}\n*\n* @example\n* function fcn( i, next ) {\n* setTimeout( onTimeout, i );\n* function onTimeout() {\n* next( null, i );\n* }\n* }\n*\n* function done( error, out ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( JSON.stringify( out ) );\n* // => [ 0, 1, 2, 3, 4 ]\n* }\n*\n* mapFunAsync( fcn, 5, done );\n*/\nfunction mapFunAsync( fcn, n, options, done ) {\n\tif ( arguments.length < 4 ) {\n\t\treturn factory( fcn )( n, options );\n\t}\n\tfactory( options, fcn )( n, done );\n}\n\n\n// EXPORTS //\n\nexport default mapFunAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* 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/**\n* Invoke a function `n` times and return an array of accumulated function return values.\n*\n* @module @stdlib/utils-async-map-function\n*\n* @example\n* import mapFunAsync from '@stdlib/utils-async-map-function';\n*\n* function fcn( i, next ) {\n* setTimeout( onTimeout, i );\n* function onTimeout() {\n* next( null, i );\n* }\n* }\n*\n* function done( error, out ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( JSON.stringify( out ) );\n* // => [ 0, 1, 2, 3, 4 ]\n* }\n*\n* mapFunAsync( fcn, 5, done );\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// 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// 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* 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/**\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// 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// 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// 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// 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 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// MODULES //\n\nvar logger = require( 'debug' );\nimport objectKeys from '@stdlib/utils-keys';\n\n\n// VARIABLES //\n\nvar debug = logger( 'map-values-async:limit' );\n\n\n// MAIN //\n\n/**\n* Invokes a function once for each own property in a source object, limiting the number of concurrently pending functions.\n*\n* ## Notes\n*\n* - Iteration order is **not** guaranteed.\n* - We need to cache an object value to prevent the edge case where, during the invocation of the transform function, the value corresponding to a particular key is swapped for some other value. For some, that might be a feature; here, we take the stance that one should be less clever.\n*\n* @private\n* @param {Object} obj - source object\n* @param {Options} opts - function options\n* @param {*} [opts.thisArg] - execution context\n* @param {PositiveInteger} [opts.limit] - maximum number of pending function invocations\n* @param {Function} fcn - function to invoke\n* @param {Callback} done - function to invoke upon completion or upon encountering an error\n* @returns {void}\n*/\nfunction limit( obj, opts, fcn, done ) {\n\tvar maxIndex;\n\tvar count;\n\tvar keys;\n\tvar flg;\n\tvar lim;\n\tvar len;\n\tvar idx;\n\tvar out;\n\tvar i;\n\n\tkeys = objectKeys( obj );\n\tlen = keys.length;\n\tdebug( 'Number of keys: %d', len );\n\n\tout = {};\n\tif ( len === 0 ) {\n\t\tdebug( 'Finished processing an object.' );\n\t\treturn done( null, out );\n\t}\n\tif ( len < opts.limit ) {\n\t\tlim = len;\n\t} else {\n\t\tlim = opts.limit;\n\t}\n\tdebug( 'Concurrency limit: %d', lim );\n\tdebug( 'Number of arguments: %d', fcn.length );\n\n\tmaxIndex = len - 1;\n\tcount = 0;\n\tidx = -1;\n\tfor ( i = 0; i < lim; i++ ) {\n\t\t// This guard is necessary to protect against synchronous functions which exhaust all properties...\n\t\tif ( idx < maxIndex ) {\n\t\t\tnext(); // eslint-disable-line node/callback-return\n\t\t}\n\t}\n\t/**\n\t* Callback to invoke a provided function for the next property.\n\t*\n\t* @private\n\t*/\n\tfunction next() {\n\t\tvar value;\n\t\tvar key;\n\n\t\tidx += 1;\n\t\tkey = keys[ idx ];\n\n\t\tvalue = obj[ key ];\n\t\tdebug( '%s: %s', key, JSON.stringify( value ) );\n\n\t\tif ( fcn.length === 2 ) {\n\t\t\tfcn.call( opts.thisArg, key, cb );\n\t\t} else if ( fcn.length === 3 ) {\n\t\t\tfcn.call( opts.thisArg, key, value, cb );\n\t\t} else {\n\t\t\tfcn.call( opts.thisArg, key, value, obj, cb );\n\t\t}\n\t\t/**\n\t\t* Callback invoked once a provided function finishes transforming a property.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {*} [key] - transformed key\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction cb( error, key ) {\n\t\t\tif ( flg ) {\n\t\t\t\t// Prevent further processing of properties:\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( error ) {\n\t\t\t\tflg = true;\n\t\t\t\treturn clbk( error );\n\t\t\t}\n\t\t\tdebug( 'Transform result => %s: %s', key, JSON.stringify( value ) );\n\t\t\tout[ key ] = value;\n\t\t\tclbk();\n\t\t}\n\t}\n\n\t/**\n\t* Callback invoked once ready to process the next property.\n\t*\n\t* @private\n\t* @param {*} [error] - error\n\t* @returns {void}\n\t*/\n\tfunction clbk( error ) {\n\t\tif ( error ) {\n\t\t\tdebug( 'Encountered an error: %s', error.message );\n\t\t\treturn done( error );\n\t\t}\n\t\tcount += 1;\n\t\tdebug( 'Processed %d of %d properties.', count, len );\n\t\tif ( idx < maxIndex ) {\n\t\t\treturn next();\n\t\t}\n\t\tif ( count === len ) {\n\t\t\tdebug( 'Finished processing an object.' );\n\t\t\treturn done( null, out );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default limit;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 format from '@stdlib/string-format';\nimport PINF from '@stdlib/constants-float64-pinf';\nimport validate from './validate.js';\nimport limit from './limit.js';\n\n\n// MAIN //\n\n/**\n* Returns a function to map keys from one object to a new object having the same values.\n*\n* ## Notes\n*\n* - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n* - Iteration and insertion order are **not** guaranteed.\n* - The function only operates on own properties, not inherited properties.\n*\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next own property\n* @param {Function} transform - transform function\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} last argument must be a function\n* @returns {Function} function which maps keys from one object to a new object having the same values\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function read( key, value, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( value, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, key+':unreadable' );\n* }\n* next( null, key+':readable' );\n* }\n* }\n*\n* var opts = {\n* 'series': true\n* };\n*\n* // Create a reusable function:\n* var mapKeysAsync = factory( opts, read );\n*\n* // Create a dictionary of file names:\n* var files = {\n* 'file1': './beep.js',\n* 'file2': './boop.js'\n* };\n*\n* // Define a callback which handles errors:\n* function done( error, out ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( out );\n* }\n*\n* // Process each file in `files`:\n* mapKeysAsync( files, done );\n*/\nfunction factory( options, transform ) {\n\tvar opts;\n\tvar err;\n\tvar f;\n\n\topts = {};\n\tif ( arguments.length > 1 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t\tf = transform;\n\t} else {\n\t\tf = options;\n\t}\n\tif ( !isFunction( f ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', f ) );\n\t}\n\tif ( opts.series ) {\n\t\topts.limit = 1;\n\t} else if ( !opts.limit ) {\n\t\topts.limit = PINF;\n\t}\n\treturn mapKeysAsync;\n\n\t/**\n\t* Maps keys from one object to a new object having the same values.\n\t*\n\t* @private\n\t* @param {Object} obj - source object\n\t* @param {Callback} done - function to invoke upon completion\n\t* @throws {TypeError} first argument must be an object\n\t* @throws {TypeError} last argument must be a function\n\t* @returns {void}\n\t*/\n\tfunction mapKeysAsync( obj, done ) {\n\t\tif ( typeof obj !== 'object' || obj === null ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be an object. Value: `%s`.', obj ) );\n\t\t}\n\t\tif ( !isFunction( done ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t\t}\n\t\treturn limit( obj, opts, f, clbk );\n\n\t\t/**\n\t\t* Callback invoked upon completion.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {Object} [out] - output object\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction clbk( error, out ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\tdone( null, out );\n\t\t}\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 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 isPositiveInteger } from '@stdlib/assert-is-positive-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 {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next own property\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'thisArg': {},\n* 'series': false,\n* 'limit': 10\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, 'thisArg' ) ) {\n\t\topts.thisArg = options.thisArg;\n\t}\n\tif ( hasOwnProp( options, 'series' ) ) {\n\t\topts.series = options.series;\n\t\tif ( !isBoolean( opts.series ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'series', opts.series ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'limit' ) ) {\n\t\topts.limit = options.limit;\n\t\tif ( !isPositiveInteger( opts.limit ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport factory from './factory.js';\n\n\n// MAIN //\n\n/**\n* Maps keys from one object to a new object having the same values.\n*\n* ## Notes\n*\n* - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n* - Iteration and insertion order are **not** guaranteed.\n* - The function only operates on own properties, not inherited properties.\n*\n* @param {Object} obj - source object\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next own property\n* @param {Function} transform - transform function\n* @param {Callback} done - function to invoke upon completion\n* @throws {TypeError} first argument must be an object\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} second-to-last argument must be a function\n* @throws {TypeError} last argument must be a function\n* @returns {void}\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function read( key, value, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( value, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, key+':unreadable' );\n* }\n* next( null, key+':readable' );\n* }\n* }\n*\n* // Define a callback which handles errors:\n* function done( error, out ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( out );\n* }\n*\n* // Create a dictionary of file names:\n* var files = {\n* 'file1': './beep.js',\n* 'file2': './boop.js'\n* };\n*\n* var opts = {\n* 'series': true\n* };\n*\n* // Process each file in `files`:\n* mapKeysAsync( files, opts, read, done );\n*/\nfunction mapKeysAsync( obj, options, transform, done ) {\n\tif ( arguments.length < 4 ) {\n\t\treturn factory( options )( obj, transform );\n\t}\n\tfactory( options, transform )( obj, done );\n}\n\n\n// EXPORTS //\n\nexport default mapKeysAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Map keys from one object to a new object having the same values.\n*\n* @module @stdlib/utils-async-map-keys\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n* import mapKeysAsync from '@stdlib/utils-async-map-keys';\n*\n* function read( key, value, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( value, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, key+':unreadable' );\n* }\n* next( null, key+':readable' );\n* }\n* }\n*\n* // Define a callback which handles errors:\n* function done( error, out ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( out );\n* }\n*\n* // Create a dictionary of file names:\n* var files = {\n* 'file1': './beep.js',\n* 'file2': './boop.js'\n* };\n*\n* var opts = {\n* 'series': true\n* };\n*\n* // Process each file in `files`:\n* mapKeysAsync( files, opts, read, done );\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport objectKeys from '@stdlib/utils-keys';\n\n\n// VARIABLES //\n\nvar debug = logger( 'map-values-async:limit' );\n\n\n// MAIN //\n\n/**\n* Invokes a function once for each own property in a source object, limiting the number of concurrently pending functions.\n*\n* @private\n* @param {Object} obj - source object\n* @param {Options} opts - function options\n* @param {*} [opts.thisArg] - execution context\n* @param {PositiveInteger} [opts.limit] - maximum number of pending function invocations\n* @param {Function} fcn - function to invoke\n* @param {Callback} done - function to invoke upon completion or upon encountering an error\n* @returns {void}\n*/\nfunction limit( obj, opts, fcn, done ) {\n\tvar maxIndex;\n\tvar count;\n\tvar keys;\n\tvar flg;\n\tvar lim;\n\tvar len;\n\tvar idx;\n\tvar out;\n\tvar i;\n\n\tkeys = objectKeys( obj );\n\tlen = keys.length;\n\tdebug( 'Number of keys: %d', len );\n\n\tout = {};\n\tif ( len === 0 ) {\n\t\tdebug( 'Finished processing an object.' );\n\t\treturn done( null, out );\n\t}\n\tif ( len < opts.limit ) {\n\t\tlim = len;\n\t} else {\n\t\tlim = opts.limit;\n\t}\n\tdebug( 'Concurrency limit: %d', lim );\n\tdebug( 'Number of arguments: %d', fcn.length );\n\n\tmaxIndex = len - 1;\n\tcount = 0;\n\tidx = -1;\n\tfor ( i = 0; i < lim; i++ ) {\n\t\t// This guard is necessary to protect against synchronous functions which exhaust all properties...\n\t\tif ( idx < maxIndex ) {\n\t\t\tnext(); // eslint-disable-line node/callback-return\n\t\t}\n\t}\n\t/**\n\t* Callback to invoke a provided function for the next property.\n\t*\n\t* @private\n\t*/\n\tfunction next() {\n\t\tvar key;\n\t\tidx += 1;\n\t\tkey = keys[ idx ];\n\t\tdebug( '%s: %s', key, JSON.stringify( obj[ key ] ) );\n\t\tif ( fcn.length === 2 ) {\n\t\t\tfcn.call( opts.thisArg, obj[ key ], cb );\n\t\t} else if ( fcn.length === 3 ) {\n\t\t\tfcn.call( opts.thisArg, obj[ key ], key, cb );\n\t\t} else {\n\t\t\tfcn.call( opts.thisArg, obj[ key ], key, obj, cb );\n\t\t}\n\t\t/**\n\t\t* Callback invoked once a provided function finishes transforming a property value.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {*} [value] - transformed value\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction cb( error, value ) {\n\t\t\tif ( flg ) {\n\t\t\t\t// Prevent further processing of properties:\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( error ) {\n\t\t\t\tflg = true;\n\t\t\t\treturn clbk( error );\n\t\t\t}\n\t\t\tdebug( 'Transform result => %s: %s', key, JSON.stringify( value ) );\n\t\t\tout[ key ] = value;\n\t\t\tclbk();\n\t\t}\n\t}\n\n\t/**\n\t* Callback invoked once ready to process the next property.\n\t*\n\t* @private\n\t* @param {*} [error] - error\n\t* @returns {void}\n\t*/\n\tfunction clbk( error ) {\n\t\tif ( error ) {\n\t\t\tdebug( 'Encountered an error: %s', error.message );\n\t\t\treturn done( error );\n\t\t}\n\t\tcount += 1;\n\t\tdebug( 'Processed %d of %d properties.', count, len );\n\t\tif ( idx < maxIndex ) {\n\t\t\treturn next();\n\t\t}\n\t\tif ( count === len ) {\n\t\t\tdebug( 'Finished processing an object.' );\n\t\t\treturn done( null, out );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default limit;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 format from '@stdlib/string-format';\nimport PINF from '@stdlib/constants-float64-pinf';\nimport validate from './validate.js';\nimport limit from './limit.js';\n\n\n// MAIN //\n\n/**\n* Returns a function to map values from one object to a new object having the same keys.\n*\n* ## Notes\n*\n* - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n* - Iteration and insertion order are **not** guaranteed.\n* - The function only operates on own properties, not inherited properties.\n*\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next own property\n* @param {Function} transform - transform function\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} last argument must be a function\n* @returns {Function} function which maps values from one object to a new object having the same keys\n*\n* @example\n* var stat = require( 'fs' ).stat;\n*\n* function getStats( file, next ) {\n* stat( file, onStats );\n*\n* function onStats( error, data ) {\n* if ( error ) {\n* return next( error );\n* }\n* next( null, data );\n* }\n* }\n*\n* var opts = {\n* 'series': true\n* };\n*\n* // Create a reusable function:\n* var mapValuesAsync = factory( opts, getStats );\n*\n* // Create a dictionary of file names:\n* var files = {\n* 'file1': './beep.js',\n* 'file2': './boop.js'\n* };\n*\n* // Define a callback which handles errors:\n* function done( error, out ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( out );\n* }\n*\n* // Process each file in `files`:\n* mapValuesAsync( files, done );\n*/\nfunction factory( options, transform ) {\n\tvar opts;\n\tvar err;\n\tvar f;\n\n\topts = {};\n\tif ( arguments.length > 1 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t\tf = transform;\n\t} else {\n\t\tf = options;\n\t}\n\tif ( !isFunction( f ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', f ) );\n\t}\n\tif ( opts.series ) {\n\t\topts.limit = 1;\n\t} else if ( !opts.limit ) {\n\t\topts.limit = PINF;\n\t}\n\treturn mapValuesAsync;\n\n\t/**\n\t* Maps values from one object to a new object having the same keys.\n\t*\n\t* @private\n\t* @param {Object} obj - source object\n\t* @param {Callback} done - function to invoke upon completion\n\t* @throws {TypeError} first argument must be an object\n\t* @throws {TypeError} last argument must be a function\n\t* @returns {void}\n\t*/\n\tfunction mapValuesAsync( obj, done ) {\n\t\tif ( typeof obj !== 'object' || obj === null ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be an object. Value: `%s`.', obj ) );\n\t\t}\n\t\tif ( !isFunction( done ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t\t}\n\t\treturn limit( obj, opts, f, clbk );\n\n\t\t/**\n\t\t* Callback invoked upon completion.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {Object} [out] - output object\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction clbk( error, out ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\tdone( null, out );\n\t\t}\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 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 isPositiveInteger } from '@stdlib/assert-is-positive-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 {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next own property\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'thisArg': {},\n* 'series': false,\n* 'limit': 10\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, 'thisArg' ) ) {\n\t\topts.thisArg = options.thisArg;\n\t}\n\tif ( hasOwnProp( options, 'series' ) ) {\n\t\topts.series = options.series;\n\t\tif ( !isBoolean( opts.series ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'series', opts.series ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'limit' ) ) {\n\t\topts.limit = options.limit;\n\t\tif ( !isPositiveInteger( opts.limit ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport factory from './factory.js';\n\n\n// MAIN //\n\n/**\n* Maps values from one object to a new object having the same keys.\n*\n* ## Notes\n*\n* - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n* - Iteration and insertion order are **not** guaranteed.\n* - The function only operates on own properties, not inherited properties.\n*\n* @param {Object} obj - source object\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next own property\n* @param {Function} transform - transform function\n* @param {Callback} done - function to invoke upon completion\n* @throws {TypeError} first argument must be an object\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} second-to-last argument must be a function\n* @throws {TypeError} last argument must be a function\n* @returns {void}\n*\n* @example\n* var stat = require( 'fs' ).stat;\n*\n* function getStats( file, next ) {\n* stat( file, onStats );\n*\n* function onStats( error, data ) {\n* if ( error ) {\n* return next( error );\n* }\n* next( null, data );\n* }\n* }\n*\n* // Define a callback which handles errors:\n* function done( error, out ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( out );\n* }\n*\n* // Create a dictionary of file names:\n* var files = {\n* 'file1': './beep.js',\n* 'file2': './boop.js'\n* };\n*\n* var opts = {\n* 'series': true\n* };\n*\n* // Process each file in `files`:\n* mapValuesAsync( files, opts, getStats, done );\n*/\nfunction mapValuesAsync( obj, options, transform, done ) {\n\tif ( arguments.length < 4 ) {\n\t\treturn factory( options )( obj, transform );\n\t}\n\tfactory( options, transform )( obj, done );\n}\n\n\n// EXPORTS //\n\nexport default mapValuesAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Map values from one object to a new object having the same keys.\n*\n* @module @stdlib/utils-async-map-values\n*\n* @example\n* var stat = require( 'fs' ).stat;\n* import mapValuesAsync from '@stdlib/utils-async-map-values';\n*\n* function getStats( file, next ) {\n* stat( file, onStats );\n*\n* function onStats( error, data ) {\n* if ( error ) {\n* return next( error );\n* }\n* next( null, data );\n* }\n* }\n*\n* // Define a callback which handles errors:\n* function done( error, out ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( out );\n* }\n*\n* // Create a dictionary of file names:\n* var files = {\n* 'file1': './beep.js',\n* 'file2': './boop.js'\n* };\n*\n* var opts = {\n* 'series': true\n* };\n*\n* // Process each file in `files`:\n* mapValuesAsync( files, opts, getStats, done );\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'none-by-async:limit' );\n\n\n// MAIN //\n\n/**\n* Invokes a predicate function once for each element in a collection, limiting the number of concurrently pending functions.\n*\n* @private\n* @param {Collection} collection - input collection\n* @param {Options} opts - function options\n* @param {*} [opts.thisArg] - execution context\n* @param {PositiveInteger} [opts.limit] - maximum number of pending function invocations\n* @param {Function} predicate - predicate function\n* @param {Callback} done - function to invoke upon completion or upon encountering an error\n* @returns {void}\n*/\nfunction limit( collection, opts, predicate, done ) {\n\tvar maxIndex;\n\tvar count;\n\tvar flg;\n\tvar lim;\n\tvar len;\n\tvar idx;\n\tvar i;\n\n\tlen = collection.length;\n\tdebug( 'Collection length: %d', len );\n\n\tif ( len === 0 ) {\n\t\tdebug( 'Finished processing a collection.' );\n\t\treturn done( null, true );\n\t}\n\tif ( len < opts.limit ) {\n\t\tlim = len;\n\t} else {\n\t\tlim = opts.limit;\n\t}\n\tdebug( 'Concurrency limit: %d', lim );\n\tdebug( 'Number of arguments: %d', predicate.length );\n\n\tmaxIndex = len - 1;\n\tcount = 0;\n\tidx = -1;\n\tfor ( i = 0; i < lim; i++ ) {\n\t\t// This guard is necessary to protect against synchronous functions which exhaust all collection elements...\n\t\tif ( idx < maxIndex ) {\n\t\t\tnext(); // eslint-disable-line node/callback-return\n\t\t}\n\t}\n\n\t/**\n\t* Callback to invoke a provided function for the next element in a collection.\n\t*\n\t* @private\n\t*/\n\tfunction next() {\n\t\tidx += 1;\n\t\tdebug( 'Collection element %d: %s.', idx, JSON.stringify( collection[ idx ] ) );\n\t\tif ( predicate.length === 2 ) {\n\t\t\tpredicate.call( opts.thisArg, collection[ idx ], clbk );\n\t\t} else if ( predicate.length === 3 ) {\n\t\t\tpredicate.call( opts.thisArg, collection[ idx ], idx, clbk );\n\t\t} else {\n\t\t\tpredicate.call( opts.thisArg, collection[ idx ], idx, collection, clbk ); // eslint-disable-line max-len\n\t\t}\n\t}\n\n\t/**\n\t* Callback invoked once a provided function finishes processing a collection element.\n\t*\n\t* @private\n\t* @param {*} [error] - error\n\t* @param {*} [result] - test result\n\t* @returns {void}\n\t*/\n\tfunction clbk( error, result ) {\n\t\tif ( flg ) {\n\t\t\t// Prevent further processing of collection elements:\n\t\t\treturn;\n\t\t}\n\t\tif ( error ) {\n\t\t\tflg = true;\n\t\t\tdebug( 'Encountered an error: %s', error.message );\n\t\t\treturn done( error );\n\t\t}\n\t\tcount += 1;\n\t\tdebug( 'Processed %d of %d collection elements.', count, len );\n\n\t\tdebug( 'Test result: %s', !!result );\n\t\tif ( result && !flg ) {\n\t\t\tflg = true;\n\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\treturn done( null, false );\n\t\t}\n\t\tif ( idx < maxIndex ) {\n\t\t\treturn next();\n\t\t}\n\t\tif ( count === len ) {\n\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\treturn done( null, true );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default limit;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isCollection from '@stdlib/assert-is-collection';\nimport format from '@stdlib/string-format';\nimport PINF from '@stdlib/constants-float64-pinf';\nimport validate from './validate.js';\nimport limit from './limit.js';\n\n\n// MAIN //\n\n/**\n* Returns a function for testing whether all elements in a collection fail a test implemented by a predicate function.\n*\n* ## Notes\n*\n* - If a predicate function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} predicate - predicate function to invoke for each element in a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} last argument must be a function\n* @returns {Function} function which invokes the predicate function once for each element in a collection\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* var opts = {\n* 'series': true\n* };\n*\n* // Create an `noneByAsync` function which invokes the predicate function for each collection element sequentially:\n* var noneByAsync = factory( opts, predicate );\n*\n* // Create a collection over which to iterate:\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* // Define a callback which handles results:\n* function done( error, bool ) {\n* if ( error ) {\n* throw error;\n* }\n* if ( bool ) {\n* console.log( 'Was unable to read all files.' );\n* } else {\n* console.log( 'Was able to read at least one file.' );\n* }\n* }\n*\n* // Try to read each element in `files`:\n* noneByAsync( files, done );\n*/\nfunction factory( options, predicate ) {\n\tvar opts;\n\tvar err;\n\tvar f;\n\n\topts = {};\n\tif ( arguments.length > 1 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t\tf = predicate;\n\t} else {\n\t\tf = options;\n\t}\n\tif ( !isFunction( f ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', f ) );\n\t}\n\tif ( opts.series ) {\n\t\topts.limit = 1;\n\t} else if ( !opts.limit ) {\n\t\topts.limit = PINF;\n\t}\n\treturn noneByAsync;\n\n\t/**\n\t* Invokes a predicate function for each element in a collection.\n\t*\n\t* @private\n\t* @param {Collection} collection - input collection\n\t* @param {Callback} done - function to invoke upon completion\n\t* @throws {TypeError} first argument must be a collection\n\t* @throws {TypeError} last argument must be a function\n\t* @returns {void}\n\t*/\n\tfunction noneByAsync( collection, done ) {\n\t\tif ( !isCollection( collection ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a collection. Value: `%s`.', collection ) );\n\t\t}\n\t\tif ( !isFunction( done ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t\t}\n\t\treturn limit( collection, opts, f, clbk );\n\n\t\t/**\n\t\t* Callback invoked upon completion.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {boolean} bool - test result\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction clbk( error, bool ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error, false );\n\t\t\t}\n\t\t\tdone( null, bool );\n\t\t}\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 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 isPositiveInteger } from '@stdlib/assert-is-positive-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 {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'thisArg': {},\n* 'series': false,\n* 'limit': 10\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, 'thisArg' ) ) {\n\t\topts.thisArg = options.thisArg;\n\t}\n\tif ( hasOwnProp( options, 'series' ) ) {\n\t\topts.series = options.series;\n\t\tif ( !isBoolean( opts.series ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'series', opts.series ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'limit' ) ) {\n\t\topts.limit = options.limit;\n\t\tif ( !isPositiveInteger( opts.limit ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport factory from './factory.js';\n\n\n// MAIN //\n\n/**\n* Tests whether all elements in a collection fail a test implemented by a predicate function.\n*\n* ## Notes\n*\n* - If a predicate function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Collection} collection - input collection\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} predicate - predicate function to invoke for each element in a collection\n* @param {Callback} done - function to invoke upon completion\n* @throws {TypeError} first argument must be a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} second-to-last argument must be a function\n* @throws {TypeError} last argument must be a function\n* @returns {void}\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function done( error, bool ) {\n* if ( error ) {\n* throw error;\n* }\n* if ( bool ) {\n* console.log( 'Was unable to read all files.' );\n* } else {\n* console.log( 'Was able to read at least one file.' );\n* }\n* }\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* noneByAsync( files, predicate, done );\n*/\nfunction noneByAsync( collection, options, predicate, done ) {\n\tif ( arguments.length < 4 ) {\n\t\treturn factory( options )( collection, predicate );\n\t}\n\tfactory( options, predicate )( collection, done );\n}\n\n\n// EXPORTS //\n\nexport default noneByAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\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 whether all elements in a collection fail a test implemented by a predicate function.\n*\n* @module @stdlib/utils-async-none-by\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n* import noneByAsync from '@stdlib/utils-async-none-by';\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* function done( error, bool ) {\n* if ( error ) {\n* throw error;\n* }\n* if ( bool ) {\n* console.log( 'Was unable to read all files.' );\n* } else {\n* console.log( 'Was able to read at least one file.' );\n* }\n* }\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* noneByAsync( files, predicate, done );\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'none-by-right-async:limit' );\n\n\n// MAIN //\n\n/**\n* Invokes a predicate function once for each element in a collection, limiting the number of concurrently pending functions, and iterating from right to left.\n*\n* @private\n* @param {Collection} collection - input collection\n* @param {Options} opts - function options\n* @param {*} [opts.thisArg] - execution context\n* @param {PositiveInteger} [opts.limit] - maximum number of pending function invocations\n* @param {Function} predicate - predicate function\n* @param {Callback} done - function to invoke upon completion or upon encountering an error\n* @returns {void}\n*/\nfunction limit( collection, opts, predicate, done ) {\n\tvar count;\n\tvar flg;\n\tvar lim;\n\tvar len;\n\tvar idx;\n\tvar i;\n\n\tlen = collection.length;\n\tdebug( 'Collection length: %d', len );\n\n\tif ( len === 0 ) {\n\t\tdebug( 'Finished processing a collection.' );\n\t\treturn done( null, true );\n\t}\n\tif ( len < opts.limit ) {\n\t\tlim = len;\n\t} else {\n\t\tlim = opts.limit;\n\t}\n\tdebug( 'Concurrency limit: %d', lim );\n\tdebug( 'Number of arguments: %d', predicate.length );\n\n\tcount = 0;\n\tidx = len;\n\tfor ( i = 0; i < lim; i++ ) {\n\t\t// This guard is necessary to protect against synchronous functions which exhaust all collection elements...\n\t\tif ( idx > 0 ) {\n\t\t\tnext(); // eslint-disable-line node/callback-return\n\t\t}\n\t}\n\n\t/**\n\t* Callback to invoke a provided function for the next element in a collection.\n\t*\n\t* @private\n\t*/\n\tfunction next() {\n\t\tidx -= 1;\n\t\tdebug( 'Collection element %d: %s.', idx, JSON.stringify( collection[ idx ] ) );\n\t\tif ( predicate.length === 2 ) {\n\t\t\tpredicate.call( opts.thisArg, collection[ idx ], clbk );\n\t\t} else if ( predicate.length === 3 ) {\n\t\t\tpredicate.call( opts.thisArg, collection[ idx ], idx, clbk );\n\t\t} else {\n\t\t\tpredicate.call( opts.thisArg, collection[ idx ], idx, collection, clbk ); // eslint-disable-line max-len\n\t\t}\n\t}\n\n\t/**\n\t* Callback invoked once a provided function finishes processing a collection element.\n\t*\n\t* @private\n\t* @param {*} [error] - error\n\t* @param {*} [result] - test result\n\t* @returns {void}\n\t*/\n\tfunction clbk( error, result ) {\n\t\tif ( flg ) {\n\t\t\t// Prevent further processing of collection elements:\n\t\t\treturn;\n\t\t}\n\t\tif ( error ) {\n\t\t\tflg = true;\n\t\t\tdebug( 'Encountered an error: %s', error.message );\n\t\t\treturn done( error );\n\t\t}\n\t\tcount += 1;\n\t\tdebug( 'Processed %d of %d collection elements.', count, len );\n\n\t\tdebug( 'Test result: %s', !!result );\n\t\tif ( result && !flg ) {\n\t\t\tflg = true;\n\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\treturn done( null, false );\n\t\t}\n\t\tif ( idx > 0 ) {\n\t\t\treturn next();\n\t\t}\n\t\tif ( count === len ) {\n\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\treturn done( null, true );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default limit;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isCollection from '@stdlib/assert-is-collection';\nimport format from '@stdlib/string-format';\nimport PINF from '@stdlib/constants-float64-pinf';\nimport validate from './validate.js';\nimport limit from './limit.js';\n\n\n// MAIN //\n\n/**\n* Returns a function for testing whether all elements in a collection fail a test implemented by a predicate function, iterating from right to left.\n*\n* ## Notes\n*\n* - If a predicate function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} predicate - predicate function to invoke for each element in a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} last argument must be a function\n* @returns {Function} function which invokes the predicate function once for each element in a collection\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* var opts = {\n* 'series': true\n* };\n*\n* // Create an `noneByRightAsync` function which invokes the predicate function for each collection element sequentially:\n* var noneByRightAsync = factory( opts, predicate );\n*\n* // Create a collection over which to iterate:\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* // Define a callback which handles results:\n* function done( error, bool ) {\n* if ( error ) {\n* throw error;\n* }\n* if ( bool ) {\n* console.log( 'Was unable to read all files.' );\n* } else {\n* console.log( 'Was able to read at least one file.' );\n* }\n* }\n*\n* // Try to read each element in `files`:\n* noneByRightAsync( files, done );\n*/\nfunction factory( options, predicate ) {\n\tvar opts;\n\tvar err;\n\tvar f;\n\n\topts = {};\n\tif ( arguments.length > 1 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t\tf = predicate;\n\t} else {\n\t\tf = options;\n\t}\n\tif ( !isFunction( f ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', f ) );\n\t}\n\tif ( opts.series ) {\n\t\topts.limit = 1;\n\t} else if ( !opts.limit ) {\n\t\topts.limit = PINF;\n\t}\n\treturn noneByRightAsync;\n\n\t/**\n\t* Invokes a predicate function for each element in a collection, iterating from right to left.\n\t*\n\t* @private\n\t* @param {Collection} collection - input collection\n\t* @param {Callback} done - function to invoke upon completion\n\t* @throws {TypeError} first argument must be a collection\n\t* @throws {TypeError} last argument must be a function\n\t* @returns {void}\n\t*/\n\tfunction noneByRightAsync( collection, done ) {\n\t\tif ( !isCollection( collection ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a collection. Value: `%s`.', collection ) );\n\t\t}\n\t\tif ( !isFunction( done ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t\t}\n\t\treturn limit( collection, opts, f, clbk );\n\n\t\t/**\n\t\t* Callback invoked upon completion.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {boolean} bool - test result\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction clbk( error, bool ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error, false );\n\t\t\t}\n\t\t\tdone( null, bool );\n\t\t}\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 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 isPositiveInteger } from '@stdlib/assert-is-positive-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 {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'thisArg': {},\n* 'series': false,\n* 'limit': 10\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, 'thisArg' ) ) {\n\t\topts.thisArg = options.thisArg;\n\t}\n\tif ( hasOwnProp( options, 'series' ) ) {\n\t\topts.series = options.series;\n\t\tif ( !isBoolean( opts.series ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'series', opts.series ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'limit' ) ) {\n\t\topts.limit = options.limit;\n\t\tif ( !isPositiveInteger( opts.limit ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport factory from './factory.js';\n\n\n// MAIN //\n\n/**\n* Tests whether all elements in a collection fail a test implemented by a predicate function, iterating from right to left.\n*\n* ## Notes\n*\n* - If a predicate function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Collection} collection - input collection\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} predicate - predicate function to invoke for each element in a collection\n* @param {Callback} done - function to invoke upon completion\n* @throws {TypeError} first argument must be a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} second-to-last argument must be a function\n* @throws {TypeError} last argument must be a function\n* @returns {void}\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function done( error, bool ) {\n* if ( error ) {\n* throw error;\n* }\n* if ( bool ) {\n* console.log( 'Was unable to read all files.' );\n* } else {\n* console.log( 'Was able to read at least one file.' );\n* }\n* }\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* noneByRightAsync( files, predicate, done );\n*/\nfunction noneByRightAsync( collection, options, predicate, done ) {\n\tif ( arguments.length < 4 ) {\n\t\treturn factory( options )( collection, predicate );\n\t}\n\tfactory( options, predicate )( collection, done );\n}\n\n\n// EXPORTS //\n\nexport default noneByRightAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\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 whether all elements in a collection fail a test implemented by a predicate function, iterating from right to left.\n*\n* @module @stdlib/utils-async-none-by-right\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n* import noneByRightAsync from '@stdlib/utils-async-none-by-right';\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* function done( error, bool ) {\n* if ( error ) {\n* throw error;\n* }\n* if ( bool ) {\n* console.log( 'Was unable to read all files.' );\n* } else {\n* console.log( 'Was able to read at least one file.' );\n* }\n* }\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* noneByRightAsync( files, predicate, done );\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'reduce-async:limit' );\n\n\n// MAIN //\n\n/**\n* Invokes a function once for each element in a collection, limiting the number of concurrently pending functions.\n*\n* @private\n* @param {Collection} collection - input collection\n* @param {*} acc - initial value\n* @param {Options} opts - function options\n* @param {*} [opts.thisArg] - execution context\n* @param {PositiveInteger} [opts.limit] - maximum number of pending function invocations\n* @param {Function} fcn - function to invoke\n* @param {Callback} done - function to invoke upon completion or upon encountering an error\n* @returns {void}\n*/\nfunction limit( collection, acc, opts, fcn, done ) {\n\tvar maxIndex;\n\tvar count;\n\tvar flg;\n\tvar lim;\n\tvar len;\n\tvar idx;\n\tvar i;\n\n\tlen = collection.length;\n\tdebug( 'Collection length: %d', len );\n\n\tif ( len === 0 ) {\n\t\tdebug( 'Finished processing a collection.' );\n\t\treturn done( null, acc );\n\t}\n\tif ( len < opts.limit ) {\n\t\tlim = len;\n\t} else {\n\t\tlim = opts.limit;\n\t}\n\tdebug( 'Concurrency limit: %d', lim );\n\tdebug( 'Number of arguments: %d', fcn.length );\n\n\tmaxIndex = len - 1;\n\tcount = 0;\n\tidx = -1;\n\tfor ( i = 0; i < lim; i++ ) {\n\t\t// This guard is necessary to protect against synchronous functions which exhaust all collection elements...\n\t\tif ( idx < maxIndex ) {\n\t\t\tnext(); // eslint-disable-line node/callback-return\n\t\t}\n\t}\n\t/**\n\t* Callback to invoke a provided function for the next element in a collection.\n\t*\n\t* @private\n\t*/\n\tfunction next() {\n\t\tidx += 1;\n\t\tdebug( 'Collection element %d: %s.', idx, JSON.stringify( collection[ idx ] ) );\n\t\tif ( fcn.length === 3 ) {\n\t\t\tfcn.call( opts.thisArg, acc, collection[ idx ], cb );\n\t\t} else if ( fcn.length === 4 ) {\n\t\t\tfcn.call( opts.thisArg, acc, collection[ idx ], idx, cb );\n\t\t} else {\n\t\t\tfcn.call( opts.thisArg, acc, collection[ idx ], idx, collection, cb ); // eslint-disable-line max-len\n\t\t}\n\t\t/**\n\t\t* Callback invoked once a provided function finishes processing a collection element.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {*} [result] - accumulation result\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction cb( error, result ) {\n\t\t\tif ( flg ) {\n\t\t\t\t// Prevent further processing of collection elements:\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( error ) {\n\t\t\t\tflg = true;\n\t\t\t\treturn clbk( error );\n\t\t\t}\n\t\t\tdebug( 'Accumulator: %s', JSON.stringify( result ) );\n\t\t\tacc = result;\n\t\t\tclbk();\n\t\t}\n\t}\n\n\t/**\n\t* Callback invoked once ready to process the next collection element.\n\t*\n\t* @private\n\t* @param {*} [error] - error\n\t* @returns {void}\n\t*/\n\tfunction clbk( error ) {\n\t\tif ( error ) {\n\t\t\tdebug( 'Encountered an error: %s', error.message );\n\t\t\treturn done( error );\n\t\t}\n\t\tcount += 1;\n\t\tdebug( 'Processed %d of %d collection elements.', count, len );\n\t\tif ( idx < maxIndex ) {\n\t\t\treturn next();\n\t\t}\n\t\tif ( count === len ) {\n\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\treturn done( null, acc );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default limit;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isCollection from '@stdlib/assert-is-collection';\nimport format from '@stdlib/string-format';\nimport PINF from '@stdlib/constants-float64-pinf';\nimport validate from './validate.js';\nimport limit from './limit.js';\n\n\n// MAIN //\n\n/**\n* Returns a function to apply a function against an accumulator and each element in a collection and return the accumulated result.\n*\n* ## Notes\n*\n* - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=true] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} fcn - function to invoke for each element in a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} last argument must be a function\n* @returns {Function} function which invokes the provided function once for each element in a collection\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function read( acc, file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error, data ) {\n* if ( error ) {\n* return next( null, acc );\n* }\n* acc.count += 1;\n* next( null, acc );\n* }\n* }\n*\n* var opts = {\n* 'series': false\n* };\n*\n* // Create a `reduceAsync` function which invokes `read` for each collection element concurrently:\n* var reduceAsync = factory( opts, read );\n*\n* // Create a collection over which to iterate:\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* // Define a callback which handles errors:\n* function done( error, acc ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( acc.count );\n* }\n*\n* // Run `read` for each element in `files`:\n* var acc = {\n* 'count': 0\n* };\n* reduceAsync( files, acc, done );\n*/\nfunction factory( options, fcn ) {\n\tvar opts;\n\tvar err;\n\tvar f;\n\n\topts = {};\n\tif ( arguments.length > 1 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t\tf = fcn;\n\t} else {\n\t\tf = options;\n\t}\n\tif ( !isFunction( f ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', f ) );\n\t}\n\tif ( opts.series === void 0 && opts.limit === void 0 ) {\n\t\topts.series = true;\n\t}\n\tif ( opts.series ) {\n\t\topts.limit = 1;\n\t} else if ( !opts.limit ) {\n\t\topts.limit = PINF;\n\t}\n\treturn reduceAsync;\n\n\t/**\n\t* Applies a function against an accumulator and each element in a collection and return the accumulated result.\n\t*\n\t* @private\n\t* @param {Collection} collection - input collection\n\t* @param {*} initial - initial value\n\t* @param {Callback} done - function to invoke upon completion\n\t* @throws {TypeError} first argument must be a collection\n\t* @throws {TypeError} last argument must be a function\n\t* @returns {void}\n\t*/\n\tfunction reduceAsync( collection, initial, done ) {\n\t\tif ( !isCollection( collection ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a collection. Value: `%s`.', collection ) );\n\t\t}\n\t\tif ( !isFunction( done ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t\t}\n\t\treturn limit( collection, initial, opts, f, clbk );\n\n\t\t/**\n\t\t* Callback invoked upon completion.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {*} [acc] - accumulated value\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction clbk( error, acc ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\tdone( null, acc );\n\t\t}\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 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 isPositiveInteger } from '@stdlib/assert-is-positive-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 {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'thisArg': {},\n* 'series': false,\n* 'limit': 10\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, 'thisArg' ) ) {\n\t\topts.thisArg = options.thisArg;\n\t}\n\tif ( hasOwnProp( options, 'series' ) ) {\n\t\topts.series = options.series;\n\t\tif ( !isBoolean( opts.series ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'series', opts.series ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'limit' ) ) {\n\t\topts.limit = options.limit;\n\t\tif ( !isPositiveInteger( opts.limit ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport factory from './factory.js';\n\n\n// MAIN //\n\n/**\n* Applies a function against an accumulator and each element in a collection and return the accumulated result.\n*\n* ## Notes\n*\n* - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Collection} collection - input collection\n* @param {*} initial - initial value\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=true] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} fcn - function to invoke for each element in a collection\n* @param {Callback} done - function to invoke upon completion\n* @throws {TypeError} first argument must be a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} second-to-last argument must be a function\n* @throws {TypeError} last argument must be a function\n* @returns {void}\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function done( error, acc ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( acc.count );\n* }\n*\n* function read( acc, file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, acc );\n* }\n* acc.count += 1;\n* next( null, acc );\n* }\n* }\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n* var acc = {\n* 'count': 0\n* };\n* reduceAsync( files, acc, read, done );\n*/\nfunction reduceAsync( collection, initial, options, fcn, done ) {\n\tif ( arguments.length < 5 ) {\n\t\treturn factory( options )( collection, initial, fcn );\n\t}\n\tfactory( options, fcn )( collection, initial, done );\n}\n\n\n// EXPORTS //\n\nexport default reduceAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Apply a function against an accumulator and each element in a collection and return the accumulated result.\n*\n* @module @stdlib/utils-async-reduce\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n* import reduceAsync from '@stdlib/utils-async-reduce';\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* function done( error, acc ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( acc.count );\n* }\n*\n* function read( acc, file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, acc );\n* }\n* acc.count += 1;\n* next( null, acc );\n* }\n* }\n*\n* var acc = {\n* 'count': 0\n* };\n* reduceAsync( files, acc, read, done );\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'reduce-right-async:limit' );\n\n\n// MAIN //\n\n/**\n* Invokes a function once for each element in a collection, limiting the number of concurrently pending functions and iterating from right to left.\n*\n* @private\n* @param {Collection} collection - input collection\n* @param {*} acc - initial value\n* @param {Options} opts - function options\n* @param {*} [opts.thisArg] - execution context\n* @param {PositiveInteger} [opts.limit] - maximum number of pending function invocations\n* @param {Function} fcn - function to invoke\n* @param {Callback} done - function to invoke upon completion or upon encountering an error\n* @returns {void}\n*/\nfunction limit( collection, acc, opts, fcn, done ) {\n\tvar count;\n\tvar flg;\n\tvar lim;\n\tvar len;\n\tvar idx;\n\tvar i;\n\n\tlen = collection.length;\n\tdebug( 'Collection length: %d', len );\n\n\tif ( len === 0 ) {\n\t\tdebug( 'Finished processing a collection.' );\n\t\treturn done( null, acc );\n\t}\n\tif ( len < opts.limit ) {\n\t\tlim = len;\n\t} else {\n\t\tlim = opts.limit;\n\t}\n\tdebug( 'Concurrency limit: %d', lim );\n\tdebug( 'Number of arguments: %d', fcn.length );\n\n\tcount = 0;\n\tidx = len;\n\tfor ( i = 0; i < lim; i++ ) {\n\t\t// This guard is necessary to protect against synchronous functions which exhaust all collection elements...\n\t\tif ( idx > 0 ) {\n\t\t\tnext(); // eslint-disable-line node/callback-return\n\t\t}\n\t}\n\t/**\n\t* Callback to invoke a provided function for the next element in a collection.\n\t*\n\t* @private\n\t*/\n\tfunction next() {\n\t\tidx -= 1;\n\t\tdebug( 'Collection element %d: %s.', idx, JSON.stringify( collection[ idx ] ) );\n\t\tif ( fcn.length === 3 ) {\n\t\t\tfcn.call( opts.thisArg, acc, collection[ idx ], cb );\n\t\t} else if ( fcn.length === 4 ) {\n\t\t\tfcn.call( opts.thisArg, acc, collection[ idx ], idx, cb );\n\t\t} else {\n\t\t\tfcn.call( opts.thisArg, acc, collection[ idx ], idx, collection, cb ); // eslint-disable-line max-len\n\t\t}\n\t\t/**\n\t\t* Callback invoked once a provided function finishes processing a collection element.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {*} [result] - accumulation result\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction cb( error, result ) {\n\t\t\tif ( flg ) {\n\t\t\t\t// Prevent further processing of collection elements:\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( error ) {\n\t\t\t\tflg = true;\n\t\t\t\treturn clbk( error );\n\t\t\t}\n\t\t\tdebug( 'Accumulator: %s', JSON.stringify( result ) );\n\t\t\tacc = result;\n\t\t\tclbk();\n\t\t}\n\t}\n\n\t/**\n\t* Callback invoked once ready to process the next collection element.\n\t*\n\t* @private\n\t* @param {*} [error] - error\n\t* @returns {void}\n\t*/\n\tfunction clbk( error ) {\n\t\tif ( error ) {\n\t\t\tdebug( 'Encountered an error: %s', error.message );\n\t\t\treturn done( error );\n\t\t}\n\t\tcount += 1;\n\t\tdebug( 'Processed %d of %d collection elements.', count, len );\n\t\tif ( idx > 0 ) {\n\t\t\treturn next();\n\t\t}\n\t\tif ( count === len ) {\n\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\treturn done( null, acc );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default limit;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isCollection from '@stdlib/assert-is-collection';\nimport format from '@stdlib/string-format';\nimport PINF from '@stdlib/constants-float64-pinf';\nimport validate from './validate.js';\nimport limit from './limit.js';\n\n\n// MAIN //\n\n/**\n* Returns a function to apply a function against an accumulator and each element in a collection and return the accumulated result, iterating from right to left.\n*\n* ## Notes\n*\n* - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=true] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} fcn - function to invoke for each element in a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} last argument must be a function\n* @returns {Function} function which invokes the provided function once for each element in a collection\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function read( acc, file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error, data ) {\n* if ( error ) {\n* return next( null, acc );\n* }\n* acc.count += 1;\n* next( null, acc );\n* }\n* }\n*\n* var opts = {\n* 'series': false\n* };\n*\n* // Create a `reduceRightAsync` function which invokes `read` for each collection element concurrently:\n* var reduceRightAsync = factory( opts, read );\n*\n* // Create a collection over which to iterate:\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* // Define a callback which handles errors:\n* function done( error, acc ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( acc.count );\n* }\n*\n* // Run `read` for each element in `files`:\n* var acc = {\n* 'count': 0\n* };\n* reduceRightAsync( files, acc, done );\n*/\nfunction factory( options, fcn ) {\n\tvar opts;\n\tvar err;\n\tvar f;\n\n\topts = {};\n\tif ( arguments.length > 1 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t\tf = fcn;\n\t} else {\n\t\tf = options;\n\t}\n\tif ( !isFunction( f ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', f ) );\n\t}\n\tif ( opts.series === void 0 && opts.limit === void 0 ) {\n\t\topts.series = true;\n\t}\n\tif ( opts.series ) {\n\t\topts.limit = 1;\n\t} else if ( !opts.limit ) {\n\t\topts.limit = PINF;\n\t}\n\treturn reduceRightAsync;\n\n\t/**\n\t* Applies a function against an accumulator and each element in a collection and return the accumulated result, iterating from right to left.\n\t*\n\t* @private\n\t* @param {Collection} collection - input collection\n\t* @param {*} initial - initial value\n\t* @param {Callback} done - function to invoke upon completion\n\t* @throws {TypeError} first argument must be a collection\n\t* @throws {TypeError} last argument must be a function\n\t* @returns {void}\n\t*/\n\tfunction reduceRightAsync( collection, initial, done ) {\n\t\tif ( !isCollection( collection ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a collection. Value: `%s`.', collection ) );\n\t\t}\n\t\tif ( !isFunction( done ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t\t}\n\t\treturn limit( collection, initial, opts, f, clbk );\n\n\t\t/**\n\t\t* Callback invoked upon completion.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {*} [acc] - accumulated value\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction clbk( error, acc ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\tdone( null, acc );\n\t\t}\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 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 isPositiveInteger } from '@stdlib/assert-is-positive-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 {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'thisArg': {},\n* 'series': false,\n* 'limit': 10\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, 'thisArg' ) ) {\n\t\topts.thisArg = options.thisArg;\n\t}\n\tif ( hasOwnProp( options, 'series' ) ) {\n\t\topts.series = options.series;\n\t\tif ( !isBoolean( opts.series ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'series', opts.series ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'limit' ) ) {\n\t\topts.limit = options.limit;\n\t\tif ( !isPositiveInteger( opts.limit ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport factory from './factory.js';\n\n\n// MAIN //\n\n/**\n* Applies a function against an accumulator and each element in a collection and return the accumulated result, iterating from right to left.\n*\n* ## Notes\n*\n* - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Collection} collection - input collection\n* @param {*} initial - initial value\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=true] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} fcn - function to invoke for each element in a collection\n* @param {Callback} done - function to invoke upon completion\n* @throws {TypeError} first argument must be a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} second-to-last argument must be a function\n* @throws {TypeError} last argument must be a function\n* @returns {void}\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function done( error, acc ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( acc.count );\n* }\n*\n* function read( acc, file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, acc );\n* }\n* acc.count += 1;\n* next( null, acc );\n* }\n* }\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n* var acc = {\n* 'count': 0\n* };\n* reduceRightAsync( files, acc, read, done );\n*/\nfunction reduceRightAsync( collection, initial, options, fcn, done ) {\n\tif ( arguments.length < 5 ) {\n\t\treturn factory( options )( collection, initial, fcn );\n\t}\n\tfactory( options, fcn )( collection, initial, done );\n}\n\n\n// EXPORTS //\n\nexport default reduceRightAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Apply a function against an accumulator and each element in a collection and return the accumulated result, iterating from right to left.\n*\n* @module @stdlib/utils-async-reduce-right\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n* import reduceRightAsync from '@stdlib/utils-async-reduce-right';\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* function done( error, acc ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( acc.count );\n* }\n*\n* function read( acc, file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, acc );\n* }\n* acc.count += 1;\n* next( null, acc );\n* }\n* }\n*\n* var acc = {\n* 'count': 0\n* };\n* reduceRightAsync( files, acc, read, done );\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Maximum length of a generic array.\n*\n* @module @stdlib/constants-array-max-array-length\n*\n* @example\n* import MAX_ARRAY_LENGTH from '@stdlib/constants-array-max-array-length';\n* // returns 4294967295\n*/\n\n// MAIN //\n\n/**\n* Maximum length of a generic array.\n*\n* ```tex\n* 2^{32} - 1\n* ```\n*\n* @constant\n* @type {uinteger32}\n* @default 4294967295\n*/\nvar MAX_ARRAY_LENGTH = 4294967295>>>0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default MAX_ARRAY_LENGTH;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Test if a value is an array-like object containing only functions.\n*\n* @module @stdlib/assert-is-function-array\n*\n* @example\n* import isFunctionArray from '@stdlib/assert-is-function-array';\n*\n* function beep() {}\n*\n* function boop() {}\n*\n* var bool = isFunctionArray( [ beep, boop ] );\n* // returns true\n*\n* bool = isFunctionArray( [ {}, beep ] );\n* // returns false\n*\n* bool = isFunctionArray( [] );\n* // returns false\n*/\n\n// MODULES //\n\nimport arrayfun from '@stdlib/assert-tools-array-like-function';\nimport isFunction from '@stdlib/assert-is-function';\n\n\n// MAIN //\n\nvar isFunctionArray = arrayfun( isFunction );\n\n\n// EXPORTS //\n\nexport default isFunctionArray;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isArrayLike from '@stdlib/assert-is-array-like';\nimport format from '@stdlib/string-format';\n\n\n// MAIN //\n\n/**\n* Returns a function which tests if every element in an array-like object passes a test condition.\n*\n* @param {Function} predicate - function to apply\n* @throws {TypeError} must provide a function\n* @returns {Function} an array-like object 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 = arraylikefcn( isOdd );\n*\n* var bool = validate( arr1 );\n* // returns true\n*\n* bool = validate( arr2 );\n* // returns false\n*/\nfunction arraylikefcn( 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-like object 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-like object 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 ( !isArrayLike( 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 arraylikefcn;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isInteger from '@stdlib/math-base-assert-is-integer';\nimport MAX_LENGTH from '@stdlib/constants-array-max-array-length';\n\n\n// MAIN //\n\n/**\n* Tests if a value is array-like.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is array-like\n*\n* @example\n* var bool = isArrayLike( [] );\n* // returns true\n*\n* @example\n* var bool = isArrayLike( {'length':10} );\n* // returns true\n*/\nfunction isArrayLike( value ) {\n\treturn (\n\t\tvalue !== void 0 &&\n\t\tvalue !== null &&\n\t\ttypeof value !== 'function' &&\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 isArrayLike;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isFunctionArray from '@stdlib/assert-is-function-array';\nimport isFunction from '@stdlib/assert-is-function';\nimport format from '@stdlib/string-format';\n\n\n// MAIN //\n\n/**\n* Returns a reusable waterfall function.\n*\n* @param {FunctionArray} fcns - array of functions\n* @param {Callback} clbk - callback to invoke upon completion\n* @param {*} [thisArg] - function context\n* @throws {TypeError} first argument must be an array of functions\n* @throws {TypeError} second argument must be a function\n* @returns {Function} waterfall function\n*\n* @example\n* function foo( next ) {\n* next( null, 'beep' );\n* }\n*\n* function bar( str, next ) {\n* console.log( str );\n* // => 'beep'\n*\n* next();\n* }\n*\n* function done( error ) {\n* if ( error ) {\n* throw error;\n* }\n* }\n*\n* var fcns = [ foo, bar ];\n*\n* var waterfall = factory( fcns, done );\n*\n* waterfall();\n* waterfall();\n* waterfall();\n*/\nfunction factory( fcns, clbk, thisArg ) {\n\tif ( !isFunctionArray( fcns ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an array of functions. Value: `%s`.', fcns ) );\n\t}\n\tif ( !isFunction( clbk ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a function. Value: `%s`.', clbk ) );\n\t}\n\treturn waterfall;\n\n\t/**\n\t* Executes functions in series, passing the results of one function as arguments to the next function.\n\t*\n\t* @private\n\t*/\n\tfunction waterfall() {\n\t\tvar idx = -1;\n\t\tnext(); // eslint-disable-line node/callback-return\n\n\t\t/**\n\t\t* Executes the next function in the series.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {...*} args - results to pass to next callback\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next() {\n\t\t\tvar args;\n\t\t\tvar len;\n\t\t\tvar i;\n\n\t\t\t// Check for an error...\n\t\t\tif ( arguments[ 0 ] ) {\n\t\t\t\treturn clbk( arguments[ 0 ] );\n\t\t\t}\n\t\t\t// Update the counter and check if we have run all functions...\n\t\t\tidx += 1;\n\t\t\tif ( idx >= fcns.length ) {\n\t\t\t\treturn clbk();\n\t\t\t}\n\t\t\t// Copy the remaining arguments...\n\t\t\tlen = arguments.length;\n\t\t\targs = new Array( len );\n\t\t\tfor ( i = 0; i < len-1; i++ ) {\n\t\t\t\targs[ i ] = arguments[ i+1 ];\n\t\t\t}\n\t\t\t// Add the callback:\n\t\t\targs[ i ] = next;\n\n\t\t\t// Apply the arguments to the next function in the waterfall:\n\t\t\tfcns[ idx ].apply( thisArg, args );\n\t\t}\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 factory from './factory.js';\n\n\n// MAIN //\n\n/**\n* Executes functions in series, passing the results of one function as arguments to the next function.\n*\n* @param {FunctionArray} fcns - array of functions\n* @param {Callback} clbk - callback to invoke upon completion\n* @param {*} [thisArg] - function context\n* @throws {TypeError} first argument must be an array of functions\n* @throws {TypeError} second argument must be a function\n*\n* @example\n* function foo( next ) {\n* next( null, 'beep' );\n* }\n*\n* function bar( str, next ) {\n* console.log( str );\n* // => 'beep'\n*\n* next();\n* }\n*\n* function done( error ) {\n* if ( error ) {\n* throw error;\n* }\n* }\n*\n* var fcns = [ foo, bar ];\n*\n* waterfall( fcns, done );\n*/\nfunction waterfall( fcns, clbk, thisArg ) {\n\tfactory( fcns, clbk, thisArg )();\n}\n\n\n// EXPORTS //\n\nexport default waterfall;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Execute functions in series, passing the results of one function as arguments to the next function.\n*\n* @module @stdlib/utils-async-series-waterfall\n*\n* @example\n* import waterfall from '@stdlib/utils-async-series-waterfall';\n*\n* function foo( next ) {\n* next( null, 'beep' );\n* }\n*\n* function bar( str, next ) {\n* console.log( str );\n* // => 'beep'\n*\n* next();\n* }\n*\n* function done( error ) {\n* if ( error ) {\n* throw error;\n* }\n* }\n*\n* var fcns = [ foo, bar ];\n*\n* waterfall( fcns, done );\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'some-by-async:limit' );\n\n\n// MAIN //\n\n/**\n* Invokes a predicate function once for each element in a collection, limiting the number of concurrently pending functions.\n*\n* @private\n* @param {Collection} collection - input collection\n* @param {PositiveInteger} n - number of elements\n* @param {Options} opts - function options\n* @param {*} [opts.thisArg] - execution context\n* @param {PositiveInteger} [opts.limit] - maximum number of pending function invocations\n* @param {Function} predicate - predicate function\n* @param {Callback} done - function to invoke upon completion or upon encountering an error\n* @returns {void}\n*/\nfunction limit( collection, n, opts, predicate, done ) {\n\tvar maxIndex;\n\tvar count;\n\tvar flg;\n\tvar lim;\n\tvar len;\n\tvar idx;\n\tvar cnt;\n\tvar i;\n\n\tlen = collection.length;\n\tdebug( 'Collection length: %d', len );\n\n\tif ( len === 0 ) {\n\t\tdebug( 'Finished processing a collection.' );\n\t\treturn done( null, false );\n\t}\n\tif ( len < opts.limit ) {\n\t\tlim = len;\n\t} else {\n\t\tlim = opts.limit;\n\t}\n\tdebug( 'Concurrency limit: %d', lim );\n\tdebug( 'Number of arguments: %d', predicate.length );\n\n\tmaxIndex = len - 1;\n\tcount = 0; // processed element count\n\tidx = -1;\n\tcnt = 0; // success count\n\tfor ( i = 0; i < lim; i++ ) {\n\t\t// This guard is necessary to protect against synchronous functions which exhaust all collection elements...\n\t\tif ( idx < maxIndex ) {\n\t\t\tnext(); // eslint-disable-line node/callback-return\n\t\t}\n\t}\n\n\t/**\n\t* Callback to invoke a provided function for the next element in a collection.\n\t*\n\t* @private\n\t*/\n\tfunction next() {\n\t\tidx += 1;\n\t\tdebug( 'Collection element %d: %s.', idx, JSON.stringify( collection[ idx ] ) );\n\t\tif ( predicate.length === 2 ) {\n\t\t\tpredicate.call( opts.thisArg, collection[ idx ], clbk );\n\t\t} else if ( predicate.length === 3 ) {\n\t\t\tpredicate.call( opts.thisArg, collection[ idx ], idx, clbk );\n\t\t} else {\n\t\t\tpredicate.call( opts.thisArg, collection[ idx ], idx, collection, clbk ); // eslint-disable-line max-len\n\t\t}\n\t}\n\n\t/**\n\t* Callback invoked once a provided function finishes processing a collection element.\n\t*\n\t* @private\n\t* @param {*} [error] - error\n\t* @param {*} [result] - test result\n\t* @returns {void}\n\t*/\n\tfunction clbk( error, result ) {\n\t\tif ( flg ) {\n\t\t\t// Prevent further processing of collection elements:\n\t\t\treturn;\n\t\t}\n\t\tif ( error ) {\n\t\t\tflg = true;\n\t\t\tdebug( 'Encountered an error: %s', error.message );\n\t\t\treturn done( error );\n\t\t}\n\t\tcount += 1;\n\t\tdebug( 'Processed %d of %d collection elements.', count, len );\n\n\t\tdebug( 'Test result: %s', !!result );\n\t\tif ( result && !flg ) {\n\t\t\tcnt += 1;\n\t\t\tif ( cnt === n ) {\n\t\t\t\tflg = true;\n\t\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\t\treturn done( null, true );\n\t\t\t}\n\t\t}\n\t\tif ( idx < maxIndex ) {\n\t\t\treturn next();\n\t\t}\n\t\tif ( count === len ) {\n\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\treturn done( null, false );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default limit;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isCollection from '@stdlib/assert-is-collection';\nimport { isPrimitive as isPositiveInteger } from '@stdlib/assert-is-positive-integer';\nimport format from '@stdlib/string-format';\nimport PINF from '@stdlib/constants-float64-pinf';\nimport validate from './validate.js';\nimport limit from './limit.js';\n\n\n// MAIN //\n\n/**\n* Returns a function for testing whether a collection contains at least `n` elements which pass a test implemented by a predicate function.\n*\n* ## Notes\n*\n* - If a predicate function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} predicate - predicate function to invoke for each element in a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} last argument must be a function\n* @returns {Function} function which invokes the predicate function once for each element in a collection\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* var opts = {\n* 'series': true\n* };\n*\n* // Create a `someByAsync` function which invokes the predicate function for each collection element sequentially:\n* var someByAsync = factory( opts, predicate );\n*\n* // Create a collection over which to iterate:\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* // Define a callback which handles results:\n* function done( error, bool ) {\n* if ( error ) {\n* throw error;\n* }\n* if ( bool ) {\n* console.log( 'Successfully read some files.' );\n* } else {\n* console.log( 'Unable to read some files.' );\n* }\n* }\n*\n* // Try to read each element in `files`:\n* someByAsync( files, 2, done );\n*/\nfunction factory( options, predicate ) {\n\tvar opts;\n\tvar err;\n\tvar f;\n\n\topts = {};\n\tif ( arguments.length > 1 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t\tf = predicate;\n\t} else {\n\t\tf = options;\n\t}\n\tif ( !isFunction( f ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', f ) );\n\t}\n\tif ( opts.series ) {\n\t\topts.limit = 1;\n\t} else if ( !opts.limit ) {\n\t\topts.limit = PINF;\n\t}\n\treturn someByAsync;\n\n\t/**\n\t* Invokes a predicate function for each element in a collection.\n\t*\n\t* @private\n\t* @param {Collection} collection - input collection\n\t* @param {PositiveInteger} n - number of elements\n\t* @param {Callback} done - function to invoke upon completion\n\t* @throws {TypeError} first argument must be a collection\n\t* @throws {TypeError} second argument must be a positive integer\n\t* @throws {TypeError} last argument must be a function\n\t* @returns {void}\n\t*/\n\tfunction someByAsync( collection, n, done ) {\n\t\tif ( !isCollection( collection ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a collection. Value: `%s`.', collection ) );\n\t\t}\n\t\tif ( !isPositiveInteger( n ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a positive integer. Value: `%s`.', n ) );\n\t\t}\n\t\tif ( !isFunction( done ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t\t}\n\t\treturn limit( collection, n, opts, f, clbk );\n\n\t\t/**\n\t\t* Callback invoked upon completion.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {boolean} bool - test result\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction clbk( error, bool ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error, false );\n\t\t\t}\n\t\t\tdone( null, bool );\n\t\t}\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 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 isPositiveInteger } from '@stdlib/assert-is-positive-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 {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'thisArg': {},\n* 'series': false,\n* 'limit': 10\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, 'thisArg' ) ) {\n\t\topts.thisArg = options.thisArg;\n\t}\n\tif ( hasOwnProp( options, 'series' ) ) {\n\t\topts.series = options.series;\n\t\tif ( !isBoolean( opts.series ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'series', opts.series ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'limit' ) ) {\n\t\topts.limit = options.limit;\n\t\tif ( !isPositiveInteger( opts.limit ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport factory from './factory.js';\n\n\n// MAIN //\n\n/**\n* Tests whether a collection contains at least `n` elements which pass a test implemented by a predicate function.\n*\n* ## Notes\n*\n* - If a predicate function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Collection} collection - input collection\n* @param {PositiveInteger} n - number of elements\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} predicate - predicate function to invoke for each element in a collection\n* @param {Callback} done - function to invoke upon completion\n* @throws {TypeError} first argument must be a collection\n* @throws {TypeError} second argument must be a positive integer\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} second-to-last argument must be a function\n* @throws {TypeError} last argument must be a function\n* @returns {void}\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function done( error, bool ) {\n* if ( error ) {\n* throw error;\n* }\n* if ( bool ) {\n* console.log( 'Successfully read some files.' );\n* } else {\n* console.log( 'Unable to read some files.' );\n* }\n* }\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* someByAsync( files, 2, predicate, done );\n*/\nfunction someByAsync( collection, n, options, predicate, done ) {\n\tif ( arguments.length < 5 ) {\n\t\treturn factory( options )( collection, n, predicate );\n\t}\n\tfactory( options, predicate )( collection, n, done );\n}\n\n\n// EXPORTS //\n\nexport default someByAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\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 whether a collection contains at least `n` elements which pass a test implemented by a predicate function.\n*\n* @module @stdlib/utils-async-some-by\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n* import someByAsync from '@stdlib/utils-async-some-by';\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* function done( error, bool ) {\n* if ( error ) {\n* throw error;\n* }\n* if ( bool ) {\n* console.log( 'Successfully read some files.' );\n* } else {\n* console.log( 'Unable to read some files.' );\n* }\n* }\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* someByAsync( files, 2, predicate, done );\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'some-by-right-async:limit' );\n\n\n// MAIN //\n\n/**\n* Invokes a predicate function once for each element in a collection, limiting the number of concurrently pending functions and iterating from right to left.\n*\n* @private\n* @param {Collection} collection - input collection\n* @param {PositiveInteger} n - number of elements\n* @param {Options} opts - function options\n* @param {*} [opts.thisArg] - execution context\n* @param {PositiveInteger} [opts.limit] - maximum number of pending function invocations\n* @param {Function} predicate - predicate function\n* @param {Callback} done - function to invoke upon completion or upon encountering an error\n* @returns {void}\n*/\nfunction limit( collection, n, opts, predicate, done ) {\n\tvar count;\n\tvar flg;\n\tvar lim;\n\tvar len;\n\tvar idx;\n\tvar cnt;\n\tvar i;\n\n\tlen = collection.length;\n\tdebug( 'Collection length: %d', len );\n\n\tif ( len === 0 ) {\n\t\tdebug( 'Finished processing a collection.' );\n\t\treturn done( null, false );\n\t}\n\tif ( len < opts.limit ) {\n\t\tlim = len;\n\t} else {\n\t\tlim = opts.limit;\n\t}\n\tdebug( 'Concurrency limit: %d', lim );\n\tdebug( 'Number of arguments: %d', predicate.length );\n\n\tcount = 0; // processed element count\n\tidx = len;\n\tcnt = 0; // success count\n\tfor ( i = 0; i < lim; i++ ) {\n\t\t// This guard is necessary to protect against synchronous functions which exhaust all collection elements...\n\t\tif ( idx > 0 ) {\n\t\t\tnext(); // eslint-disable-line node/callback-return\n\t\t}\n\t}\n\n\t/**\n\t* Callback to invoke a provided function for the next element in a collection.\n\t*\n\t* @private\n\t*/\n\tfunction next() {\n\t\tidx -= 1;\n\t\tdebug( 'Collection element %d: %s.', idx, JSON.stringify( collection[ idx ] ) );\n\t\tif ( predicate.length === 2 ) {\n\t\t\tpredicate.call( opts.thisArg, collection[ idx ], clbk );\n\t\t} else if ( predicate.length === 3 ) {\n\t\t\tpredicate.call( opts.thisArg, collection[ idx ], idx, clbk );\n\t\t} else {\n\t\t\tpredicate.call( opts.thisArg, collection[ idx ], idx, collection, clbk ); // eslint-disable-line max-len\n\t\t}\n\t}\n\n\t/**\n\t* Callback invoked once a provided function finishes processing a collection element.\n\t*\n\t* @private\n\t* @param {*} [error] - error\n\t* @param {*} [result] - test result\n\t* @returns {void}\n\t*/\n\tfunction clbk( error, result ) {\n\t\tif ( flg ) {\n\t\t\t// Prevent further processing of collection elements:\n\t\t\treturn;\n\t\t}\n\t\tif ( error ) {\n\t\t\tflg = true;\n\t\t\tdebug( 'Encountered an error: %s', error.message );\n\t\t\treturn done( error );\n\t\t}\n\t\tcount += 1;\n\t\tdebug( 'Processed %d of %d collection elements.', count, len );\n\n\t\tdebug( 'Test result: %s', !!result );\n\t\tif ( result && !flg ) {\n\t\t\tcnt += 1;\n\t\t\tif ( cnt === n ) {\n\t\t\t\tflg = true;\n\t\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\t\treturn done( null, true );\n\t\t\t}\n\t\t}\n\t\tif ( idx > 0 ) {\n\t\t\treturn next();\n\t\t}\n\t\tif ( count === len ) {\n\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\treturn done( null, false );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default limit;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isFunction from '@stdlib/assert-is-function';\nimport { isPrimitive as isPositiveInteger } from '@stdlib/assert-is-positive-integer';\nimport isCollection from '@stdlib/assert-is-collection';\nimport format from '@stdlib/string-format';\nimport PINF from '@stdlib/constants-float64-pinf';\nimport validate from './validate.js';\nimport limit from './limit.js';\n\n\n// MAIN //\n\n/**\n* Returns a function for testing whether a collection contains at least `n` elements which pass a test implemented by a predicate function, iterating from right to left.\n*\n* ## Notes\n*\n* - If a predicate function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} predicate - predicate function to invoke for each element in a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} last argument must be a function\n* @returns {Function} function which invokes the predicate function once for each element in a collection\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* var opts = {\n* 'series': true\n* };\n*\n* // Create a `someByRightAsync` function which invokes the predicate function for each collection element sequentially:\n* var someByRightAsync = factory( opts, predicate );\n*\n* // Create a collection over which to iterate:\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* // Define a callback which handles results:\n* function done( error, bool ) {\n* if ( error ) {\n* throw error;\n* }\n* if ( bool ) {\n* console.log( 'Successfully read some files.' );\n* } else {\n* console.log( 'Unable to read some files.' );\n* }\n* }\n*\n* // Try to read each element in `files`:\n* someByRightAsync( files, 2, done );\n*/\nfunction factory( options, predicate ) {\n\tvar opts;\n\tvar err;\n\tvar f;\n\n\topts = {};\n\tif ( arguments.length > 1 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t\tf = predicate;\n\t} else {\n\t\tf = options;\n\t}\n\tif ( !isFunction( f ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', f ) );\n\t}\n\tif ( opts.series ) {\n\t\topts.limit = 1;\n\t} else if ( !opts.limit ) {\n\t\topts.limit = PINF;\n\t}\n\treturn someByRightAsync;\n\n\t/**\n\t* Invokes a predicate function for each element in a collection, iterating from right to left.\n\t*\n\t* @private\n\t* @param {Collection} collection - input collection\n\t* @param {PositiveInteger} n - number of elements\n\t* @param {Callback} done - function to invoke upon completion\n\t* @throws {TypeError} first argument must be a collection\n\t* @throws {TypeError} second argument must be a positive integer\n\t* @throws {TypeError} last argument must be a function\n\t* @returns {void}\n\t*/\n\tfunction someByRightAsync( collection, n, done ) {\n\t\tif ( !isCollection( collection ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a collection. Value: `%s`.', collection ) );\n\t\t}\n\t\tif ( !isPositiveInteger( n ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a positive integer. Value: `%s`.', n ) );\n\t\t}\n\t\tif ( !isFunction( done ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t\t}\n\t\treturn limit( collection, n, opts, f, clbk );\n\n\t\t/**\n\t\t* Callback invoked upon completion.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {boolean} bool - test result\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction clbk( error, bool ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error, false );\n\t\t\t}\n\t\t\tdone( null, bool );\n\t\t}\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 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 isPositiveInteger } from '@stdlib/assert-is-positive-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 {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'thisArg': {},\n* 'series': false,\n* 'limit': 10\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, 'thisArg' ) ) {\n\t\topts.thisArg = options.thisArg;\n\t}\n\tif ( hasOwnProp( options, 'series' ) ) {\n\t\topts.series = options.series;\n\t\tif ( !isBoolean( opts.series ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'series', opts.series ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'limit' ) ) {\n\t\topts.limit = options.limit;\n\t\tif ( !isPositiveInteger( opts.limit ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport factory from './factory.js';\n\n\n// MAIN //\n\n/**\n* Tests whether a collection contains at least `n` elements which pass a test implemented by a predicate function, iterating from right to left.\n*\n* ## Notes\n*\n* - If a predicate function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Collection} collection - input collection\n* @param {PositiveInteger} n - number of elements\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} predicate - predicate function to invoke for each element in a collection\n* @param {Callback} done - function to invoke upon completion\n* @throws {TypeError} first argument must be a collection\n* @throws {TypeError} second argument must be a positive integer\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} second-to-last argument must be a function\n* @throws {TypeError} last argument must be a function\n* @returns {void}\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function done( error, bool ) {\n* if ( error ) {\n* throw error;\n* }\n* if ( bool ) {\n* console.log( 'Successfully read some files.' );\n* } else {\n* console.log( 'Unable to read some files.' );\n* }\n* }\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* someByRightAsync( files, 2, predicate, done );\n*/\nfunction someByRightAsync( collection, n, options, predicate, done ) {\n\tif ( arguments.length < 5 ) {\n\t\treturn factory( options )( collection, n, predicate );\n\t}\n\tfactory( options, predicate )( collection, n, done );\n}\n\n\n// EXPORTS //\n\nexport default someByRightAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\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 whether a collection contains at least `n` elements which pass a test implemented by a predicate function, iterating from right to left.\n*\n* @module @stdlib/utils-async-some-by-right\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n* import someByRightAsync from '@stdlib/utils-async-some-by-right';\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* function done( error, bool ) {\n* if ( error ) {\n* throw error;\n* }\n* if ( bool ) {\n* console.log( 'Successfully read some files.' );\n* } else {\n* console.log( 'Unable to read some files.' );\n* }\n* }\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* someByRightAsync( files, 2, predicate, done );\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport indexOf from '@stdlib/utils-index-of';\n\n\n// VARIABLES //\n\nvar debug = logger( 'tabulate-by-async:limit' );\n\n\n// MAIN //\n\n/**\n* Invokes an indicator function once for each element in a collection, limiting the number of concurrently pending functions.\n*\n* @private\n* @param {Collection} collection - input collection\n* @param {Options} opts - function options\n* @param {*} [opts.thisArg] - execution context\n* @param {PositiveInteger} [opts.limit] - maximum number of pending function invocations\n* @param {Function} indicator - indicator function\n* @param {Callback} done - function to invoke upon completion or upon encountering an error\n* @returns {void}\n*/\nfunction limit( collection, opts, indicator, done ) {\n\tvar maxIndex;\n\tvar count;\n\tvar flg;\n\tvar lim;\n\tvar len;\n\tvar idx;\n\tvar out;\n\tvar tmp;\n\tvar i;\n\n\tlen = collection.length;\n\tdebug( 'Collection length: %d', len );\n\n\tout = [];\n\tif ( len === 0 ) {\n\t\tdebug( 'Finished processing a collection.' );\n\t\treturn done( null, out );\n\t}\n\ttmp = [];\n\tif ( len < opts.limit ) {\n\t\tlim = len;\n\t} else {\n\t\tlim = opts.limit;\n\t}\n\tdebug( 'Concurrency limit: %d', lim );\n\tdebug( 'Number of arguments: %d', indicator.length );\n\n\tmaxIndex = len - 1;\n\tcount = 0;\n\tidx = -1;\n\tfor ( i = 0; i < lim; i++ ) {\n\t\t// This guard is necessary to protect against synchronous functions which exhaust all collection elements...\n\t\tif ( idx < maxIndex ) {\n\t\t\tnext(); // eslint-disable-line node/callback-return\n\t\t}\n\t}\n\t/**\n\t* Callback to invoke a provided function for the next element in a collection.\n\t*\n\t* @private\n\t*/\n\tfunction next() {\n\t\tvar v;\n\t\tvar j;\n\n\t\tidx += 1;\n\t\tj = idx;\n\t\tv = collection[ j ];\n\n\t\tdebug( 'Collection element %d: %s.', j, JSON.stringify( v ) );\n\t\tif ( indicator.length === 2 ) {\n\t\t\tindicator.call( opts.thisArg, v, cb );\n\t\t} else if ( indicator.length === 3 ) {\n\t\t\tindicator.call( opts.thisArg, v, j, cb );\n\t\t} else {\n\t\t\tindicator.call( opts.thisArg, v, j, collection, cb );\n\t\t}\n\t\t/**\n\t\t* Callback invoked once a provided function finishes processing a collection element.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {*} [group] - group\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction cb( error, group ) {\n\t\t\tvar i;\n\t\t\tif ( flg ) {\n\t\t\t\t// Prevent further processing of collection elements:\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( error ) {\n\t\t\t\tflg = true;\n\t\t\t\treturn clbk( error );\n\t\t\t}\n\t\t\tdebug( 'Collection element %d group: %s.', j, group );\n\n\t\t\t// Determine if we've seen the group/category before. If not, cache a reference which points to its location in the output array; otherwise, update the running count.\n\t\t\ti = indexOf( tmp, group );\n\t\t\tif ( i === -1 ) {\n\t\t\t\ttmp.push( group );\n\t\t\t\tout.push( [ group, 1, 0 ] );\n\t\t\t} else {\n\t\t\t\tout[ i ][ 1 ] += 1;\n\t\t\t}\n\t\t\tclbk();\n\t\t}\n\t}\n\n\t/**\n\t* Callback invoked once ready to process the next collection element.\n\t*\n\t* @private\n\t* @param {*} [error] - error\n\t* @returns {void}\n\t*/\n\tfunction clbk( error ) {\n\t\tvar i;\n\t\tif ( error ) {\n\t\t\tdebug( 'Encountered an error: %s', error.message );\n\t\t\treturn done( error );\n\t\t}\n\t\tcount += 1;\n\t\tdebug( 'Processed %d of %d collection elements.', count, len );\n\t\tif ( idx < maxIndex ) {\n\t\t\treturn next();\n\t\t}\n\t\tif ( count === len ) {\n\t\t\t// Compute percentages...\n\t\t\tfor ( i = 0; i < out.length; i++ ) {\n\t\t\t\tout[ i ][ 2 ] = out[ i ][ 1 ] / count;\n\t\t\t}\n\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\treturn done( null, out );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default limit;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isCollection from '@stdlib/assert-is-collection';\nimport format from '@stdlib/string-format';\nimport PINF from '@stdlib/constants-float64-pinf';\nimport validate from './validate.js';\nimport limit from './limit.js';\n\n\n// MAIN //\n\n/**\n* Returns a function for generating a frequency table according to an indicator function.\n*\n* ## Notes\n*\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* - The output frequency table is an array of arrays. Each sub-array corresponds to a unique value in the input collection and is structured as follows:\n*\n* - 0: unique value\n* - 1: value count\n* - 2: frequency percentage\n*\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} indicator - function whose return values are used to populate the output frequency table\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} last argument must be a function\n* @returns {Function} function which invokes the indicator function once for each element in a collection\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function indicator( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, 'nonreadable' );\n* }\n* next( null, 'readable' );\n* }\n* }\n*\n* var opts = {\n* 'series': true\n* };\n*\n* // Create a `tabulateByAsync` function which invokes the indicator function for each collection element sequentially:\n* var tabulateByAsync = factory( opts, indicator );\n*\n* // Create a collection over which to iterate:\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* // Define a callback which handles results:\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* }\n*\n* // Try to read each element in `files`:\n* tabulateByAsync( files, done );\n*/\nfunction factory( options, indicator ) {\n\tvar opts;\n\tvar err;\n\tvar f;\n\n\topts = {};\n\tif ( arguments.length > 1 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t\tf = indicator;\n\t} else {\n\t\tf = options;\n\t}\n\tif ( !isFunction( f ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', f ) );\n\t}\n\tif ( opts.series ) {\n\t\topts.limit = 1;\n\t} else if ( !opts.limit ) {\n\t\topts.limit = PINF;\n\t}\n\treturn tabulateByAsync;\n\n\t/**\n\t* Invokes an indicator function for each element in a collection.\n\t*\n\t* @private\n\t* @param {Collection} collection - input collection\n\t* @param {Callback} done - function to invoke upon completion\n\t* @throws {TypeError} first argument must be a collection\n\t* @throws {TypeError} last argument must be a function\n\t* @returns {void}\n\t*/\n\tfunction tabulateByAsync( collection, done ) {\n\t\tif ( !isCollection( collection ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a collection. Value: `%s`.', collection ) );\n\t\t}\n\t\tif ( !isFunction( done ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t\t}\n\t\treturn limit( collection, opts, f, clbk );\n\n\t\t/**\n\t\t* Callback invoked upon completion.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {Object} result - frequency table\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction clbk( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\tdone( null, result );\n\t\t}\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 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 isPositiveInteger } from '@stdlib/assert-is-positive-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 {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'thisArg': {},\n* 'series': false,\n* 'limit': 10\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, 'thisArg' ) ) {\n\t\topts.thisArg = options.thisArg;\n\t}\n\tif ( hasOwnProp( options, 'series' ) ) {\n\t\topts.series = options.series;\n\t\tif ( !isBoolean( opts.series ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'series', opts.series ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'limit' ) ) {\n\t\topts.limit = options.limit;\n\t\tif ( !isPositiveInteger( opts.limit ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport factory from './factory.js';\n\n\n// MAIN //\n\n/**\n* Generates a frequency table according to an indicator function.\n*\n* ## Notes\n*\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* - The output frequency table is an array of arrays. Each sub-array corresponds to a unique value in the input collection and is structured as follows:\n*\n* - 0: unique value\n* - 1: value count\n* - 2: frequency percentage\n*\n* @param {Collection} collection - input collection\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} indicator - function whose return values are used to populate the output frequency table\n* @param {Callback} done - function to invoke upon completion\n* @throws {TypeError} first argument must be a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} second-to-last argument must be a function\n* @throws {TypeError} last argument must be a function\n* @returns {void}\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* }\n*\n* function indicator( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, 'nonreadable' );\n* }\n* next( null, 'readable' );\n* }\n* }\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* tabulateByAsync( files, indicator, done );\n*/\nfunction tabulateByAsync( collection, options, indicator, done ) {\n\tif ( arguments.length < 4 ) {\n\t\treturn factory( options )( collection, indicator );\n\t}\n\tfactory( options, indicator )( collection, done );\n}\n\n\n// EXPORTS //\n\nexport default tabulateByAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Generate a frequency table according to an indicator function.\n*\n* @module @stdlib/utils-async-tabulate-by\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n* import tabulateByAsync from '@stdlib/utils-async-tabulate-by';\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* }\n*\n* function indicator( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, 'nonreadable' );\n* }\n* next( null, 'readable' );\n* }\n* }\n*\n* tabulateByAsync( files, indicator, done );\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/*\n* When adding modules to the namespace, ensure that they are added in alphabetical order according to module name.\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-read-only-property';\n\n\n// MAIN //\n\n/**\n* Top-level namespace.\n*\n* @namespace ns\n*/\nvar ns = {};\n\n/**\n* @name anyByAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/any-by}\n*/\nimport anyByAsync from '@stdlib/utils-async-any-by';\nsetReadOnly( ns, 'anyByAsync', anyByAsync );\n\n/**\n* @name anyByRightAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/any-by-right}\n*/\nimport anyByRightAsync from '@stdlib/utils-async-any-by-right';\nsetReadOnly( ns, 'anyByRightAsync', anyByRightAsync );\n\n/**\n* @name bifurcateByAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/bifurcate-by}\n*/\nimport bifurcateByAsync from '@stdlib/utils-async-bifurcate-by';\nsetReadOnly( ns, 'bifurcateByAsync', bifurcateByAsync );\n\n/**\n* @name composeAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/compose}\n*/\nimport composeAsync from '@stdlib/utils-async-compose';\nsetReadOnly( ns, 'composeAsync', composeAsync );\n\n/**\n* @name countByAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/count-by}\n*/\nimport countByAsync from '@stdlib/utils-async-count-by';\nsetReadOnly( ns, 'countByAsync', countByAsync );\n\n/**\n* @name doUntilAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/do-until}\n*/\nimport doUntilAsync from '@stdlib/utils-async-do-until';\nsetReadOnly( ns, 'doUntilAsync', doUntilAsync );\n\n/**\n* @name doWhileAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/do-while}\n*/\nimport doWhileAsync from '@stdlib/utils-async-do-while';\nsetReadOnly( ns, 'doWhileAsync', doWhileAsync );\n\n/**\n* @name everyByAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/every-by}\n*/\nimport everyByAsync from '@stdlib/utils-async-every-by';\nsetReadOnly( ns, 'everyByAsync', everyByAsync );\n\n/**\n* @name everyByRightAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/every-by-right}\n*/\nimport everyByRightAsync from '@stdlib/utils-async-every-by-right';\nsetReadOnly( ns, 'everyByRightAsync', everyByRightAsync );\n\n/**\n* @name forEachAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/for-each}\n*/\nimport forEachAsync from '@stdlib/utils-async-for-each';\nsetReadOnly( ns, 'forEachAsync', forEachAsync );\n\n/**\n* @name forEachRightAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/for-each-right}\n*/\nimport forEachRightAsync from '@stdlib/utils-async-for-each-right';\nsetReadOnly( ns, 'forEachRightAsync', forEachRightAsync );\n\n/**\n* @name functionSequenceAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/function-sequence}\n*/\nimport functionSequenceAsync from '@stdlib/utils-async-function-sequence';\nsetReadOnly( ns, 'functionSequenceAsync', functionSequenceAsync );\n\n/**\n* @name groupByAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/group-by}\n*/\nimport groupByAsync from '@stdlib/utils-async-group-by';\nsetReadOnly( ns, 'groupByAsync', groupByAsync );\n\n/**\n* @name ifelseAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/if-else}\n*/\nimport ifelseAsync from '@stdlib/utils-async-if-else';\nsetReadOnly( ns, 'ifelseAsync', ifelseAsync );\n\n/**\n* @name ifthenAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/if-then}\n*/\nimport ifthenAsync from '@stdlib/utils-async-if-then';\nsetReadOnly( ns, 'ifthenAsync', ifthenAsync );\n\n/**\n* @name inmapAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/inmap}\n*/\nimport inmapAsync from '@stdlib/utils-async-inmap';\nsetReadOnly( ns, 'inmapAsync', inmapAsync );\n\n/**\n* @name inmapRightAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/inmap-right}\n*/\nimport inmapRightAsync from '@stdlib/utils-async-inmap-right';\nsetReadOnly( ns, 'inmapRightAsync', inmapRightAsync );\n\n/**\n* @name mapFunAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/map-function}\n*/\nimport mapFunAsync from '@stdlib/utils-async-map-function';\nsetReadOnly( ns, 'mapFunAsync', mapFunAsync );\n\n/**\n* @name mapKeysAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/map-keys}\n*/\nimport mapKeysAsync from '@stdlib/utils-async-map-keys';\nsetReadOnly( ns, 'mapKeysAsync', mapKeysAsync );\n\n/**\n* @name mapValuesAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/map-values}\n*/\nimport mapValuesAsync from '@stdlib/utils-async-map-values';\nsetReadOnly( ns, 'mapValuesAsync', mapValuesAsync );\n\n/**\n* @name noneByAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/none-by}\n*/\nimport noneByAsync from '@stdlib/utils-async-none-by';\nsetReadOnly( ns, 'noneByAsync', noneByAsync );\n\n/**\n* @name noneByRightAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/none-by-right}\n*/\nimport noneByRightAsync from '@stdlib/utils-async-none-by-right';\nsetReadOnly( ns, 'noneByRightAsync', noneByRightAsync );\n\n/**\n* @name reduceAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/reduce}\n*/\nimport reduceAsync from '@stdlib/utils-async-reduce';\nsetReadOnly( ns, 'reduceAsync', reduceAsync );\n\n/**\n* @name reduceRightAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/reduce-right}\n*/\nimport reduceRightAsync from '@stdlib/utils-async-reduce-right';\nsetReadOnly( ns, 'reduceRightAsync', reduceRightAsync );\n\n/**\n* @name waterfall\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/series-waterfall}\n*/\nimport waterfall from '@stdlib/utils-async-series-waterfall';\nsetReadOnly( ns, 'waterfall', waterfall );\n\n/**\n* @name someByAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/some-by}\n*/\nimport someByAsync from '@stdlib/utils-async-some-by';\nsetReadOnly( ns, 'someByAsync', someByAsync );\n\n/**\n* @name someByRightAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/some-by-right}\n*/\nimport someByRightAsync from '@stdlib/utils-async-some-by-right';\nsetReadOnly( ns, 'someByRightAsync', someByRightAsync );\n\n/**\n* @name tabulateByAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/tabulate-by}\n*/\nimport tabulateByAsync from '@stdlib/utils-async-tabulate-by';\nsetReadOnly( ns, 'tabulateByAsync', tabulateByAsync );\n\n/**\n* @name trycatchAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/try-catch}\n*/\nimport trycatchAsync from '@stdlib/utils-async-try-catch';\nsetReadOnly( ns, 'trycatchAsync', trycatchAsync );\n\n/**\n* @name trythenAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/try-then}\n*/\nimport trythenAsync from '@stdlib/utils-async-try-then';\nsetReadOnly( ns, 'trythenAsync', trythenAsync );\n\n/**\n* @name untilAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/until}\n*/\nimport untilAsync from '@stdlib/utils-async-until';\nsetReadOnly( ns, 'untilAsync', untilAsync );\n\n/**\n* @name whileAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/while}\n*/\nimport whileAsync from '@stdlib/utils-async-while';\nsetReadOnly( ns, 'whileAsync', whileAsync );\n\n\n// EXPORTS //\n\nexport default ns;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 format from '@stdlib/string-format';\n\n\n// MAIN //\n\n/**\n* Function composition.\n*\n* @param {...Function} f - functions to compose\n* @throws {Error} must provide more than one argument\n* @throws {TypeError} must provide functions\n* @returns {Function} composite function\n*\n* @example\n* function a( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, 2*x );\n* }\n* }\n*\n* function b( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x+3 );\n* }\n* }\n*\n* function c( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x/5 );\n* }\n* }\n*\n* var f = composeAsync( c, b, a );\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* // => 3\n* }\n*\n* f( 6, done );\n*/\nfunction composeAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to compose.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) );\n\t\t}\n\t}\n\treturn composite;\n\n\t/**\n\t* Composite function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction composite() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = nFuncs - 1;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a composed function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti -= 1;\n\t\t\tif ( i < 0 ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default composeAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 format from '@stdlib/string-format';\n\n\n// MAIN //\n\n/**\n* Invokes a function until a test condition is true.\n*\n* @param {Function} fcn - function to invoke\n* @param {Function} predicate - function which indicates whether to continue invoking a function\n* @param {Callback} done - callback to invoke upon completion\n* @param {*} [thisArg] - execution context for the invoked function\n* @throws {TypeError} first argument must be a function\n* @throws {TypeError} second argument must be a function\n* @throws {TypeError} third argument must be a function\n*\n* @example\n* function fcn( i, next ) {\n* setTimeout( onTimeout, i );\n* function onTimeout() {\n* console.log( 'beep: %d', i );\n* next();\n* }\n* }\n*\n* function predicate( i, clbk ) {\n* clbk( null, i >= 5 );\n* }\n*\n* function done( error ) {\n* if ( error ) {\n* throw error;\n* }\n* }\n*\n* doUntilAsync( fcn, predicate, done );\n*/\nfunction doUntilAsync( fcn, predicate, done, thisArg ) {\n\tvar args;\n\tvar idx;\n\tif ( !isFunction( fcn ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', fcn ) );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a function. Value: `%s`.', predicate ) );\n\t}\n\tif ( !isFunction( done ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Third argument must be a function. Value: `%s`.', done ) );\n\t}\n\targs = [];\n\tidx = 0;\n\tfcn.call( thisArg, idx, next );\n\n\t/**\n\t* Callback invoked upon completion of a provided function.\n\t*\n\t* @private\n\t* @param {(Error|null)} error - error object\n\t* @param {...*} results - function results\n\t* @returns {void}\n\t*/\n\tfunction next( error ) {\n\t\tvar i;\n\t\tif ( error ) {\n\t\t\treturn done( error );\n\t\t}\n\t\tidx += 1;\n\n\t\t// Cache the most recent results...\n\t\tif ( arguments.length > 1 ) {\n\t\t\targs = new Array( arguments.length-1 );\n\t\t\tfor ( i = 1; i < arguments.length; i++ ) {\n\t\t\t\targs[ i-1 ] = arguments[ i ];\n\t\t\t}\n\t\t}\n\t\t// Run the test condition:\n\t\tpredicate( idx, onPredicate );\n\t}\n\n\t/**\n\t* Callback invoked upon a predicate result.\n\t*\n\t* @private\n\t* @param {(Error|null)} error - error object\n\t* @param {boolean} result - predicate result\n\t* @returns {void}\n\t*/\n\tfunction onPredicate( error, result ) {\n\t\tif ( error ) {\n\t\t\treturn done( error );\n\t\t}\n\t\tif ( !result ) {\n\t\t\treturn fcn.call( thisArg, idx, next );\n\t\t}\n\t\tif ( args.length ) {\n\t\t\targs.unshift( null ); // error argument\n\t\t}\n\t\tdone.apply( null, args );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default doUntilAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 format from '@stdlib/string-format';\n\n\n// MAIN //\n\n/**\n* Invokes a function while a test condition is true.\n*\n* @param {Function} fcn - function to invoke\n* @param {Function} predicate - function which indicates whether to continue invoking a function\n* @param {Callback} done - callback to invoke upon completion\n* @param {*} [thisArg] - execution context for the invoked function\n* @throws {TypeError} first argument must be a function\n* @throws {TypeError} second argument must be a function\n* @throws {TypeError} third argument must be a function\n*\n* @example\n* function fcn( i, next ) {\n* setTimeout( onTimeout, i );\n* function onTimeout() {\n* console.log( 'beep: %d', i );\n* next();\n* }\n* }\n*\n* function predicate( i, clbk ) {\n* clbk( null, i < 5 );\n* }\n*\n* function done( error ) {\n* if ( error ) {\n* throw error;\n* }\n* }\n*\n* doWhileAsync( fcn, predicate, done );\n*/\nfunction doWhileAsync( fcn, predicate, done, thisArg ) {\n\tvar args;\n\tvar idx;\n\tif ( !isFunction( fcn ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', fcn ) );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a function. Value: `%s`.', predicate ) );\n\t}\n\tif ( !isFunction( done ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Third argument must be a function. Value: `%s`.', done ) );\n\t}\n\targs = [];\n\tidx = 0;\n\tfcn.call( thisArg, idx, next );\n\n\t/**\n\t* Callback invoked upon completion of a provided function.\n\t*\n\t* @private\n\t* @param {(Error|null)} error - error object\n\t* @param {...*} results - function results\n\t* @returns {void}\n\t*/\n\tfunction next( error ) {\n\t\tvar i;\n\t\tif ( error ) {\n\t\t\treturn done( error );\n\t\t}\n\t\tidx += 1;\n\n\t\t// Cache the most recent results...\n\t\tif ( arguments.length > 1 ) {\n\t\t\targs = new Array( arguments.length-1 );\n\t\t\tfor ( i = 1; i < arguments.length; i++ ) {\n\t\t\t\targs[ i-1 ] = arguments[ i ];\n\t\t\t}\n\t\t}\n\t\t// Run the test condition:\n\t\tpredicate( idx, onPredicate );\n\t}\n\n\t/**\n\t* Callback invoked upon a predicate result.\n\t*\n\t* @private\n\t* @param {(Error|null)} error - error object\n\t* @param {boolean} result - predicate result\n\t* @returns {void}\n\t*/\n\tfunction onPredicate( error, result ) {\n\t\tif ( error ) {\n\t\t\treturn done( error );\n\t\t}\n\t\tif ( result ) {\n\t\t\treturn fcn.call( thisArg, idx, next );\n\t\t}\n\t\tif ( args.length ) {\n\t\t\targs.unshift( null ); // error argument\n\t\t}\n\t\tdone.apply( null, args );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default doWhileAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 format from '@stdlib/string-format';\n\n\n// MAIN //\n\n/**\n* Function sequence.\n*\n* @param {...Function} f - functions to evaluate in sequential order\n* @throws {Error} must provide more than one argument\n* @throws {TypeError} must provide functions\n* @returns {Function} pipeline function\n*\n* @example\n* function a( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, 2*x );\n* }\n* }\n*\n* function b( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x+3 );\n* }\n* }\n*\n* function c( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x/5 );\n* }\n* }\n*\n* var f = funseqAsync( a, b, c );\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* // => 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 format from '@stdlib/string-format';\n\n\n// MAIN //\n\n/**\n* If a predicate function returns a truthy value, returns `x`; otherwise, returns `y`.\n*\n* @param {Function} predicate - predicate function\n* @param {*} x - value to return if a condition is truthy\n* @param {*} y - value to return if a condition is falsy\n* @param {Function} done - callback to invoke upon completion\n* @throws {TypeError} first argument must be a function\n* @throws {TypeError} last argument must be a function\n*\n* @example\n* import randu from '@stdlib/random-base-randu';\n*\n* function predicate( clbk ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* clbk( null, randu() > 0.5 );\n* }\n* }\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* }\n* ifelseAsync( predicate, 1.0, -1.0, done );\n*/\nfunction ifelseAsync( predicate, x, y, done ) {\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) );\n\t}\n\tif ( !isFunction( done ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t}\n\tpredicate( clbk );\n\n\t/**\n\t* Callback invoked by a predicate function.\n\t*\n\t* @private\n\t* @param {(Error|null)} error - error object\n\t* @param {boolean} bool - condition\n\t* @returns {void}\n\t*/\n\tfunction clbk( error, bool ) {\n\t\tif ( error ) {\n\t\t\treturn done( error );\n\t\t}\n\t\tif ( bool ) {\n\t\t\treturn done( null, x );\n\t\t}\n\t\tdone( null, y );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default ifelseAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 format from '@stdlib/string-format';\n\n\n// MAIN //\n\n/**\n* If a predicate function returns a truthy value, invokes `x`; otherwise, invokes `y`.\n*\n* @param {Function} predicate - predicate function\n* @param {Function} x - function to invoke if a condition is truthy\n* @param {Function} y - function to invoke if a condition is falsy\n* @param {Function} done - callback to invoke upon completion\n* @throws {TypeError} first argument must be a function\n* @throws {TypeError} second argument must be a function\n* @throws {TypeError} third argument must be a function\n* @throws {TypeError} last argument must be a function\n*\n* @example\n* import randu from '@stdlib/random-base-randu';\n*\n* function predicate( clbk ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* clbk( null, randu() > 0.5 );\n* }\n* }\n*\n* function x( clbk ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* clbk( null, 1.0 );\n* }\n* }\n*\n* function y( clbk ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* clbk( null, -1.0 );\n* }\n* }\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* }\n* ifthenAsync( predicate, x, y, done );\n*/\nfunction ifthenAsync( predicate, x, y, done ) {\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) );\n\t}\n\tif ( !isFunction( x ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a function. Value: `%s`.', x ) );\n\t}\n\tif ( !isFunction( y ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Third argument must be a function. Value: `%s`.', y ) );\n\t}\n\tif ( !isFunction( done ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t}\n\tpredicate( clbk1 );\n\n\t/**\n\t* Callback invoked by a predicate function.\n\t*\n\t* @private\n\t* @param {(Error|null)} error - error object\n\t* @param {boolean} bool - condition\n\t* @returns {void}\n\t*/\n\tfunction clbk1( error, bool ) {\n\t\tif ( error ) {\n\t\t\treturn done( error );\n\t\t}\n\t\tif ( bool ) {\n\t\t\treturn x( clbk2 );\n\t\t}\n\t\ty( clbk2 );\n\t}\n\n\t/**\n\t* Callback invoked by either `x` or `y`.\n\t*\n\t* @private\n\t* @param {(Error|null)} error - error object\n\t* @param {...*} args - results\n\t* @returns {void}\n\t*/\n\tfunction clbk2( error ) {\n\t\tvar nargs;\n\t\tvar args;\n\t\tvar i;\n\t\tif ( error ) {\n\t\t\treturn done( error );\n\t\t}\n\t\tnargs = arguments.length;\n\t\targs = new Array( nargs );\n\t\targs[ 0 ] = null;\n\t\tfor ( i = 1; i < nargs; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\tdone.apply( null, args );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default ifthenAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 format from '@stdlib/string-format';\n\n\n// MAIN //\n\n/**\n* If a function does not return an error, invokes a callback with the function result; otherwise, invokes a callback with a value `y`.\n*\n* @param {Function} x - function to invoke\n* @param {*} y - value to return if `x` returns an error\n* @param {Function} done - callback to invoke upon completion\n* @throws {TypeError} first argument must be a function\n* @throws {TypeError} last argument must be a function\n*\n* @example\n* import randu from '@stdlib/random-base-randu';\n*\n* function x( clbk ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* if ( randu() > 0.5 ) {\n* return clbk( null, 1.0 );\n* }\n* clbk( new Error( 'beep' ) );\n* }\n* }\n*\n* function done( error, result ) {\n* if ( error ) {\n* console.log( error.message );\n* }\n* console.log( result );\n* }\n*\n* trycatchAsync( x, -1.0, done );\n*/\nfunction trycatchAsync( x, y, done ) {\n\tif ( !isFunction( x ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', x ) );\n\t}\n\tif ( !isFunction( done ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t}\n\tx( clbk );\n\n\t/**\n\t* Callback invoked by `x`.\n\t*\n\t* @private\n\t* @param {(Error|null)} error - error object\n\t* @param {*} result - result\n\t* @returns {void}\n\t*/\n\tfunction clbk( error, result ) {\n\t\tif ( error ) {\n\t\t\treturn done( error, y );\n\t\t}\n\t\tdone( null, result );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default trycatchAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 format from '@stdlib/string-format';\n\n\n// MAIN //\n\n/**\n* If a function does not return an error, invokes a callback with the function result; otherwise, invokes a second function `y`.\n*\n* @param {Function} x - function to invoke\n* @param {Function} y - function to invoke if `x` returns an error\n* @param {Function} done - callback to invoke upon completion\n* @throws {TypeError} first argument must be a function\n* @throws {TypeError} second argument must be a function\n* @throws {TypeError} last argument must be a function\n*\n* @example\n* import randu from '@stdlib/random-base-randu';\n*\n* function x( clbk ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* if ( randu() > 0.5 ) {\n* return clbk( null, 1.0 );\n* }\n* clbk( new Error( 'beep' ) );\n* }\n* }\n*\n* function y( clbk ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* clbk( null, -1.0 );\n* }\n* }\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* }\n*\n* trythenAsync( x, y, done );\n*/\nfunction trythenAsync( x, y, done ) {\n\tif ( !isFunction( x ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', x ) );\n\t}\n\tif ( !isFunction( y ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a function. Value: `%s`.', y ) );\n\t}\n\tif ( !isFunction( done ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t}\n\tx( clbk1 );\n\n\t/**\n\t* Callback invoked by `x`.\n\t*\n\t* @private\n\t* @param {(Error|null)} error - error object\n\t* @param {...*} args - function results\n\t* @returns {void}\n\t*/\n\tfunction clbk1( error ) {\n\t\tvar nargs;\n\t\tvar args;\n\t\tvar i;\n\t\tif ( error ) {\n\t\t\tif ( y.length === 1 ) {\n\t\t\t\treturn y( clbk2 );\n\t\t\t}\n\t\t\treturn y( error, clbk2 );\n\t\t}\n\t\tnargs = arguments.length;\n\t\targs = new Array( nargs );\n\t\targs[ 0 ] = null;\n\t\tfor ( i = 1; i < nargs; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\treturn done.apply( null, args );\n\t}\n\n\t/**\n\t* Callback invoked by `y`.\n\t*\n\t* @private\n\t* @param {(Error|null)} error - error object\n\t* @param {...*} args - function results\n\t* @returns {void}\n\t*/\n\tfunction clbk2( error ) {\n\t\tvar nargs;\n\t\tvar args;\n\t\tvar i;\n\t\tif ( error ) {\n\t\t\treturn done( error );\n\t\t}\n\t\tnargs = arguments.length;\n\t\targs = new Array( nargs );\n\t\targs[ 0 ] = null;\n\t\tfor ( i = 1; i < nargs; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\treturn done.apply( null, args );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default trythenAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 format from '@stdlib/string-format';\n\n\n// MAIN //\n\n/**\n* Invokes a function until a test condition is true.\n*\n* @param {Function} predicate - function which indicates whether to continue invoking a function\n* @param {Function} fcn - function to invoke\n* @param {Callback} done - callback to invoke upon completion\n* @param {*} [thisArg] - execution context for the invoked function\n* @throws {TypeError} first argument must be a function\n* @throws {TypeError} second argument must be a function\n* @throws {TypeError} third argument must be a function\n*\n* @example\n* function predicate( i, clbk ) {\n* clbk( null, i >= 5 );\n* }\n*\n* function fcn( i, next ) {\n* setTimeout( onTimeout, i );\n* function onTimeout() {\n* console.log( 'beep: %d', i );\n* next();\n* }\n* }\n*\n* function done( error ) {\n* if ( error ) {\n* throw error;\n* }\n* }\n*\n* untilAsync( predicate, fcn, done );\n*/\nfunction untilAsync( predicate, fcn, done, thisArg ) {\n\tvar args;\n\tvar idx;\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) );\n\t}\n\tif ( !isFunction( fcn ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a function. Value: `%s`.', fcn ) );\n\t}\n\tif ( !isFunction( done ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Third argument must be a function. Value: `%s`.', done ) );\n\t}\n\targs = [];\n\tidx = 0;\n\tpredicate( idx, onPredicate );\n\n\t/**\n\t* Callback invoked upon a predicate result.\n\t*\n\t* @private\n\t* @param {(Error|null)} error - error object\n\t* @param {boolean} result - predicate result\n\t* @returns {void}\n\t*/\n\tfunction onPredicate( error, result ) {\n\t\tif ( error ) {\n\t\t\treturn done( error );\n\t\t}\n\t\tif ( !result ) {\n\t\t\treturn fcn.call( thisArg, idx, next );\n\t\t}\n\t\tif ( args.length ) {\n\t\t\targs.unshift( null ); // error argument\n\t\t}\n\t\tdone.apply( null, args );\n\t}\n\n\t/**\n\t* Callback invoked upon completion of a provided function.\n\t*\n\t* @private\n\t* @param {(Error|null)} error - error object\n\t* @param {...*} results - function results\n\t* @returns {void}\n\t*/\n\tfunction next( error ) {\n\t\tvar i;\n\t\tif ( error ) {\n\t\t\treturn done( error );\n\t\t}\n\t\tidx += 1;\n\n\t\t// Cache the most recent results...\n\t\tif ( arguments.length > 1 ) {\n\t\t\targs = new Array( arguments.length-1 );\n\t\t\tfor ( i = 1; i < arguments.length; i++ ) {\n\t\t\t\targs[ i-1 ] = arguments[ i ];\n\t\t\t}\n\t\t}\n\t\t// Run the test condition:\n\t\tpredicate( idx, onPredicate );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default untilAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 format from '@stdlib/string-format';\n\n\n// MAIN //\n\n/**\n* Invokes a function while a test condition is true.\n*\n* @param {Function} predicate - function which indicates whether to continue invoking a function\n* @param {Function} fcn - function to invoke\n* @param {Callback} done - callback to invoke upon completion\n* @param {*} [thisArg] - execution context for the invoked function\n* @throws {TypeError} first argument must be a function\n* @throws {TypeError} second argument must be a function\n* @throws {TypeError} third argument must be a function\n*\n* @example\n* function predicate( i, clbk ) {\n* clbk( null, i < 5 );\n* }\n*\n* function fcn( i, next ) {\n* setTimeout( onTimeout, i );\n* function onTimeout() {\n* console.log( 'beep: %d', i );\n* next();\n* }\n* }\n*\n* function done( error ) {\n* if ( error ) {\n* throw error;\n* }\n* }\n*\n* whileAsync( predicate, fcn, done );\n*/\nfunction whileAsync( predicate, fcn, done, thisArg ) {\n\tvar args;\n\tvar idx;\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) );\n\t}\n\tif ( !isFunction( fcn ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a function. Value: `%s`.', fcn ) );\n\t}\n\tif ( !isFunction( done ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Third argument must be a function. Value: `%s`.', done ) );\n\t}\n\targs = [];\n\tidx = 0;\n\tpredicate( idx, onPredicate );\n\n\t/**\n\t* Callback invoked upon a predicate result.\n\t*\n\t* @private\n\t* @param {(Error|null)} error - error object\n\t* @param {boolean} result - predicate result\n\t* @returns {void}\n\t*/\n\tfunction onPredicate( error, result ) {\n\t\tif ( error ) {\n\t\t\treturn done( error );\n\t\t}\n\t\tif ( result ) {\n\t\t\treturn fcn.call( thisArg, idx, next );\n\t\t}\n\t\tif ( args.length ) {\n\t\t\targs.unshift( null ); // error argument\n\t\t}\n\t\tdone.apply( null, args );\n\t}\n\n\t/**\n\t* Callback invoked upon completion of a provided function.\n\t*\n\t* @private\n\t* @param {(Error|null)} error - error object\n\t* @param {...*} results - function results\n\t* @returns {void}\n\t*/\n\tfunction next( error ) {\n\t\tvar i;\n\t\tif ( error ) {\n\t\t\treturn done( error );\n\t\t}\n\t\tidx += 1;\n\n\t\t// Cache the most recent results...\n\t\tif ( arguments.length > 1 ) {\n\t\t\targs = new Array( arguments.length-1 );\n\t\t\tfor ( i = 1; i < arguments.length; i++ ) {\n\t\t\t\targs[ i-1 ] = arguments[ i ];\n\t\t\t}\n\t\t}\n\t\t// Run the test condition:\n\t\tpredicate( idx, onPredicate );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default whileAsync;\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","globalThis","root","codegen","Function","GlobalThis","Self","Win","getGlobal","nodeList","document","childNodes","typedarray","Int8Array","reFunctionName","RE_FUNCTION_NAME","REGEXP","main$3","isObjectLike","constructorName","name","ctor","constructor","_isBuffer","isBuffer","predicate","len","arrayfun","ctorName","type","isFunction","typeOf","floor","isInteger","x","MAX_TYPED_ARRAY_LENGTH","isCollection","MAX_LENGTH","getProto","FLOAT64_PINF","Number","POSITIVE_INFINITY","Obj","getPrototypeOf","proto","getProto$1","objectPrototype","isPlainObject","isPrototypeOf","key","ownProps","main$1","FLOAT64_NINF","NEGATIVE_INFINITY","PINF","NINF","isInt","valueOf","isPositiveInteger","debug","require$$0","factory","options","opts","thisArg","series","limit","validate","collection","done","maxIndex","count","flg","lim","idx","next","JSON","stringify","clbk","error","result","message","bool","anyByAsync","anyByRightAsync","isNan","isString","arr","searchElement","fromIndex","returns","join","cb","results","bifurcateByAsync","indicator","group","countByAsync","everyByAsync","everyByRightAsync","fcn","forEachAsync","forEachRightAsync","groupByAsync","inmapAsync","inmapRightAsync","isNonNegativeInteger","m","mapFunAsync","keys","isArguments","bool$5","detect","hasArgumentsClass","isEnumerableProperty","propertyIsEnumerable","hasStringEnumBug","isEnum","isArguments$1","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","NON_ENUMERABLE","transform","objectKeys","mapKeysAsync","mapValuesAsync","noneByAsync","noneByRightAsync","initial","acc","reduceAsync","reduceRightAsync","MAX_ARRAY_LENGTH","isFunctionArray","isArrayLike","fcns","waterfall","cnt","someByAsync","someByRightAsync","tmp","tabulateByAsync","ns","nFuncs","onPredicate","unshift","y","clbk2","nargs"],"mappings":";yCAsBA,IAAIA,EAA0C,mBAA1BC,OAAOC,eAAkCD,OAAOC,eAAiB,KCiCjFA,EAAiBD,OAAOC,eCjB5B,SAASC,EAAUC,GAClB,MAA0B,iBAAVA,CACjB,CCAA,SAASC,EAAOC,GACf,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EAAML,GAC1C,IAAItH,EACAgI,EACJ,IAAM5C,GAAYL,GACjB,MAAM,IAAIhG,UAAWgB,EAAQ,oEAAqEgF,IAEnG,IAAMK,GAAYsE,GACjB,MAAM,IAAI3K,UAAWgB,EAAQ,qEAAsE2J,IAEpG,IAAMtE,GAAYuC,GACjB,MAAM,IAAI5I,UAAWgB,EAAQ,oEAAqE4H,IAcnG,SAASwF,EAAa9E,EAAOC,GAC5B,OAAKD,EACGV,EAAMU,GAETC,EACGoB,EAAI7M,KAAMyK,EAASU,EAAKC,IAE3BjI,EAAKzE,QACTyE,EAAKoN,QAAS,WAEfzF,EAAKxH,MAAO,KAAMH,GAClB,CAUD,SAASiI,EAAMI,GACd,IAAItN,EACJ,GAAKsN,EACJ,OAAOV,EAAMU,GAKd,GAHAL,GAAO,EAGF9I,UAAU3D,OAAS,EAEvB,IADAyE,EAAO,IAAI7B,MAAOe,UAAU3D,OAAO,GAC7BR,EAAI,EAAGA,EAAImE,UAAU3D,OAAQR,IAClCiF,EAAMjF,EAAE,GAAMmE,UAAWnE,GAI3BgK,EAAWiD,EAAKmF,EAChB,CAjDDnN,EAAO,GAEP+E,EADAiD,EAAM,EACUmF,EAgDjB","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,236,237,238,239,240,241,242,243,244,245]}
\ 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 43a0829..0000000
--- a/dist/index.js
+++ /dev/null
@@ -1,3 +0,0 @@
-"use strict";var r=require('@stdlib/utils-define-read-only-property/dist'),e={};r(e,"anyByAsync",require('@stdlib/utils-async-any-by/dist'));r(e,"anyByRightAsync",require('@stdlib/utils-async-any-by-right/dist'));r(e,"bifurcateByAsync",require('@stdlib/utils-async-bifurcate-by/dist'));r(e,"composeAsync",require('@stdlib/utils-async-compose/dist'));r(e,"countByAsync",require('@stdlib/utils-async-count-by/dist'));r(e,"doUntilAsync",require('@stdlib/utils-async-do-until/dist'));r(e,"doWhileAsync",require('@stdlib/utils-async-do-while/dist'));r(e,"everyByAsync",require('@stdlib/utils-async-every-by/dist'));r(e,"everyByRightAsync",require('@stdlib/utils-async-every-by-right/dist'));r(e,"forEachAsync",require('@stdlib/utils-async-for-each/dist'));r(e,"forEachRightAsync",require('@stdlib/utils-async-for-each-right/dist'));r(e,"functionSequenceAsync",require('@stdlib/utils-async-function-sequence/dist'));r(e,"groupByAsync",require('@stdlib/utils-async-group-by/dist'));r(e,"ifelseAsync",require('@stdlib/utils-async-if-else/dist'));r(e,"ifthenAsync",require('@stdlib/utils-async-if-then/dist'));r(e,"inmapAsync",require('@stdlib/utils-async-inmap/dist'));r(e,"inmapRightAsync",require('@stdlib/utils-async-inmap-right/dist'));r(e,"mapFunAsync",require('@stdlib/utils-async-map-function/dist'));r(e,"mapKeysAsync",require('@stdlib/utils-async-map-keys/dist'));r(e,"mapValuesAsync",require('@stdlib/utils-async-map-values/dist'));r(e,"noneByAsync",require('@stdlib/utils-async-none-by/dist'));r(e,"noneByRightAsync",require('@stdlib/utils-async-none-by-right/dist'));r(e,"reduceAsync",require('@stdlib/utils-async-reduce/dist'));r(e,"reduceRightAsync",require('@stdlib/utils-async-reduce-right/dist'));r(e,"waterfall",require('@stdlib/utils-async-series-waterfall/dist'));r(e,"someByAsync",require('@stdlib/utils-async-some-by/dist'));r(e,"someByRightAsync",require('@stdlib/utils-async-some-by-right/dist'));r(e,"tabulateByAsync",require('@stdlib/utils-async-tabulate-by/dist'));r(e,"trycatchAsync",require('@stdlib/utils-async-try-catch/dist'));r(e,"trythenAsync",require('@stdlib/utils-async-try-then/dist'));r(e,"untilAsync",require('@stdlib/utils-async-until/dist'));r(e,"whileAsync",require('@stdlib/utils-async-while/dist'));module.exports=e;
-/** @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 fbcd8e8..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 ns\n*/\nvar ns = {};\n\n/**\n* @name anyByAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/any-by}\n*/\nsetReadOnly( ns, 'anyByAsync', require( '@stdlib/utils-async-any-by' ) );\n\n/**\n* @name anyByRightAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/any-by-right}\n*/\nsetReadOnly( ns, 'anyByRightAsync', require( '@stdlib/utils-async-any-by-right' ) );\n\n/**\n* @name bifurcateByAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/bifurcate-by}\n*/\nsetReadOnly( ns, 'bifurcateByAsync', require( '@stdlib/utils-async-bifurcate-by' ) );\n\n/**\n* @name composeAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/compose}\n*/\nsetReadOnly( ns, 'composeAsync', require( '@stdlib/utils-async-compose' ) );\n\n/**\n* @name countByAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/count-by}\n*/\nsetReadOnly( ns, 'countByAsync', require( '@stdlib/utils-async-count-by' ) );\n\n/**\n* @name doUntilAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/do-until}\n*/\nsetReadOnly( ns, 'doUntilAsync', require( '@stdlib/utils-async-do-until' ) );\n\n/**\n* @name doWhileAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/do-while}\n*/\nsetReadOnly( ns, 'doWhileAsync', require( '@stdlib/utils-async-do-while' ) );\n\n/**\n* @name everyByAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/every-by}\n*/\nsetReadOnly( ns, 'everyByAsync', require( '@stdlib/utils-async-every-by' ) );\n\n/**\n* @name everyByRightAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/every-by-right}\n*/\nsetReadOnly( ns, 'everyByRightAsync', require( '@stdlib/utils-async-every-by-right' ) );\n\n/**\n* @name forEachAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/for-each}\n*/\nsetReadOnly( ns, 'forEachAsync', require( '@stdlib/utils-async-for-each' ) );\n\n/**\n* @name forEachRightAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/for-each-right}\n*/\nsetReadOnly( ns, 'forEachRightAsync', require( '@stdlib/utils-async-for-each-right' ) );\n\n/**\n* @name functionSequenceAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/function-sequence}\n*/\nsetReadOnly( ns, 'functionSequenceAsync', require( '@stdlib/utils-async-function-sequence' ) );\n\n/**\n* @name groupByAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/group-by}\n*/\nsetReadOnly( ns, 'groupByAsync', require( '@stdlib/utils-async-group-by' ) );\n\n/**\n* @name ifelseAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/if-else}\n*/\nsetReadOnly( ns, 'ifelseAsync', require( '@stdlib/utils-async-if-else' ) );\n\n/**\n* @name ifthenAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/if-then}\n*/\nsetReadOnly( ns, 'ifthenAsync', require( '@stdlib/utils-async-if-then' ) );\n\n/**\n* @name inmapAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/inmap}\n*/\nsetReadOnly( ns, 'inmapAsync', require( '@stdlib/utils-async-inmap' ) );\n\n/**\n* @name inmapRightAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/inmap-right}\n*/\nsetReadOnly( ns, 'inmapRightAsync', require( '@stdlib/utils-async-inmap-right' ) );\n\n/**\n* @name mapFunAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/map-function}\n*/\nsetReadOnly( ns, 'mapFunAsync', require( '@stdlib/utils-async-map-function' ) );\n\n/**\n* @name mapKeysAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/map-keys}\n*/\nsetReadOnly( ns, 'mapKeysAsync', require( '@stdlib/utils-async-map-keys' ) );\n\n/**\n* @name mapValuesAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/map-values}\n*/\nsetReadOnly( ns, 'mapValuesAsync', require( '@stdlib/utils-async-map-values' ) );\n\n/**\n* @name noneByAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/none-by}\n*/\nsetReadOnly( ns, 'noneByAsync', require( '@stdlib/utils-async-none-by' ) );\n\n/**\n* @name noneByRightAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/none-by-right}\n*/\nsetReadOnly( ns, 'noneByRightAsync', require( '@stdlib/utils-async-none-by-right' ) );\n\n/**\n* @name reduceAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/reduce}\n*/\nsetReadOnly( ns, 'reduceAsync', require( '@stdlib/utils-async-reduce' ) );\n\n/**\n* @name reduceRightAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/reduce-right}\n*/\nsetReadOnly( ns, 'reduceRightAsync', require( '@stdlib/utils-async-reduce-right' ) );\n\n/**\n* @name waterfall\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/series-waterfall}\n*/\nsetReadOnly( ns, 'waterfall', require( '@stdlib/utils-async-series-waterfall' ) );\n\n/**\n* @name someByAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/some-by}\n*/\nsetReadOnly( ns, 'someByAsync', require( '@stdlib/utils-async-some-by' ) );\n\n/**\n* @name someByRightAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/some-by-right}\n*/\nsetReadOnly( ns, 'someByRightAsync', require( '@stdlib/utils-async-some-by-right' ) );\n\n/**\n* @name tabulateByAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/tabulate-by}\n*/\nsetReadOnly( ns, 'tabulateByAsync', require( '@stdlib/utils-async-tabulate-by' ) );\n\n/**\n* @name trycatchAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/try-catch}\n*/\nsetReadOnly( ns, 'trycatchAsync', require( '@stdlib/utils-async-try-catch' ) );\n\n/**\n* @name trythenAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/try-then}\n*/\nsetReadOnly( ns, 'trythenAsync', require( '@stdlib/utils-async-try-then' ) );\n\n/**\n* @name untilAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/until}\n*/\nsetReadOnly( ns, 'untilAsync', require( '@stdlib/utils-async-until' ) );\n\n/**\n* @name whileAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/while}\n*/\nsetReadOnly( ns, 'whileAsync', require( '@stdlib/utils-async-while' ) );\n\n\n// EXPORTS //\n\nmodule.exports = ns;\n"],
- "mappings": "aA0BA,IAAIA,EAAc,QAAS,yCAA0C,EAUjEC,EAAK,CAAC,EASVD,EAAaC,EAAI,aAAc,QAAS,4BAA6B,CAAE,EASvED,EAAaC,EAAI,kBAAmB,QAAS,kCAAmC,CAAE,EASlFD,EAAaC,EAAI,mBAAoB,QAAS,kCAAmC,CAAE,EASnFD,EAAaC,EAAI,eAAgB,QAAS,6BAA8B,CAAE,EAS1ED,EAAaC,EAAI,eAAgB,QAAS,8BAA+B,CAAE,EAS3ED,EAAaC,EAAI,eAAgB,QAAS,8BAA+B,CAAE,EAS3ED,EAAaC,EAAI,eAAgB,QAAS,8BAA+B,CAAE,EAS3ED,EAAaC,EAA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-}
diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts
deleted file mode 100644
index aed7d43..0000000
--- a/docs/types/index.d.ts
+++ /dev/null
@@ -1,1561 +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 anyByAsync = require( '@stdlib/utils-async-any-by' );
-import anyByRightAsync = require( '@stdlib/utils-async-any-by-right' );
-import bifurcateByAsync = require( '@stdlib/utils-async-bifurcate-by' );
-import composeAsync = require( '@stdlib/utils-async-compose' );
-import countByAsync = require( '@stdlib/utils-async-count-by' );
-import doUntilAsync = require( '@stdlib/utils-async-do-until' );
-import doWhileAsync = require( '@stdlib/utils-async-do-while' );
-import everyByAsync = require( '@stdlib/utils-async-every-by' );
-import everyByRightAsync = require( '@stdlib/utils-async-every-by-right' );
-import forEachAsync = require( '@stdlib/utils-async-for-each' );
-import forEachRightAsync = require( '@stdlib/utils-async-for-each-right' );
-import functionSequenceAsync = require( '@stdlib/utils-async-function-sequence' );
-import groupByAsync = require( '@stdlib/utils-async-group-by' );
-import ifelseAsync = require( '@stdlib/utils-async-if-else' );
-import ifthenAsync = require( '@stdlib/utils-async-if-then' );
-import inmapAsync = require( '@stdlib/utils-async-inmap' );
-import inmapRightAsync = require( '@stdlib/utils-async-inmap-right' );
-import mapFunAsync = require( '@stdlib/utils-async-map-function' );
-import mapKeysAsync = require( '@stdlib/utils-async-map-keys' );
-import mapValuesAsync = require( '@stdlib/utils-async-map-values' );
-import noneByAsync = require( '@stdlib/utils-async-none-by' );
-import noneByRightAsync = require( '@stdlib/utils-async-none-by-right' );
-import reduceAsync = require( '@stdlib/utils-async-reduce' );
-import reduceRightAsync = require( '@stdlib/utils-async-reduce-right' );
-import waterfall = require( '@stdlib/utils-async-series-waterfall' );
-import someByAsync = require( '@stdlib/utils-async-some-by' );
-import someByRightAsync = require( '@stdlib/utils-async-some-by-right' );
-import tabulateByAsync = require( '@stdlib/utils-async-tabulate-by' );
-import trycatchAsync = require( '@stdlib/utils-async-try-catch' );
-import trythenAsync = require( '@stdlib/utils-async-try-then' );
-import untilAsync = require( '@stdlib/utils-async-until' );
-import whileAsync = require( '@stdlib/utils-async-while' );
-
-/**
-* Interface describing the `async` namespace.
-*/
-interface Namespace {
- /**
- * Tests whether at least one element in a collection passes a test implemented by a predicate function.
- *
- * ## Notes
- *
- * - If a predicate function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.
- * - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).
- *
- * @param collection - input collection
- * @param options - function options
- * @param options.thisArg - execution context
- * @param options.limit - maximum number of pending invocations at any one time
- * @param options.series - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection (default: false)
- * @param predicate - predicate function to invoke for each element in a collection
- * @param done - function to invoke upon completion
- * @throws must provide valid options
- *
- * @example
- * var readFile = require( '@stdlib/fs-read-file' );
- *
- * function done( error, bool ) {
- * if ( error ) {
- * throw error;
- * }
- * if ( bool ) {
- * console.log( 'Successfully read at least one file.' );
- * } else {
- * console.log( 'Unable to read any files.' );
- * }
- * }
- *
- * function predicate( file, next ) {
- * var opts = {
- * 'encoding': 'utf8'
- * };
- * readFile( file, opts, onFile );
- *
- * function onFile( error ) {
- * if ( error ) {
- * return next( null, false );
- * }
- * next( null, true );
- * }
- * }
- *
- * var files = [
- * './beep.js',
- * './boop.js'
- * ];
- *
- * ns.anyByAsync( files, predicate, done );
- */
- anyByAsync: typeof anyByAsync;
-
- /**
- * Tests whether at least one element in a collection passes a test implemented by a predicate function, iterating from right to left.
- *
- * ## Notes
- *
- * - If a predicate function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.
- * - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).
- *
- * @param collection - input collection
- * @param options - function options
- * @param options.thisArg - execution context
- * @param options.limit - maximum number of pending invocations at any one time
- * @param options.series - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection (default: false)
- * @param predicate - predicate function to invoke for each element in a collection
- * @param done - function to invoke upon completion
- * @throws must provide valid options
- *
- * @example
- * var readFile = require( '@stdlib/fs-read-file' );
- *
- * function done( error, bool ) {
- * if ( error ) {
- * throw error;
- * }
- * if ( bool ) {
- * console.log( 'Successfully read at least one file.' );
- * } else {
- * console.log( 'Unable to read any files.' );
- * }
- * }
- *
- * function predicate( file, next ) {
- * var opts = {
- * 'encoding': 'utf8'
- * };
- * readFile( file, opts, onFile );
- *
- * function onFile( error ) {
- * if ( error ) {
- * return next( null, false );
- * }
- * next( null, true );
- * }
- * }
- *
- * var files = [
- * './beep.js',
- * './boop.js'
- * ];
- *
- * ns.anyByRightAsync( files, predicate, done );
- */
- anyByRightAsync: typeof anyByRightAsync;
-
- /**
- * Splits values into two groups according to a predicate function.
- *
- * ## Notes
- *
- * - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).
- *
- * @param collection - input collection
- * @param options - function options
- * @param options.thisArg - execution context
- * @param options.limit - maximum number of pending invocations at any one time
- * @param options.series - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection (default: false)
- * @param options.returns - if `values`, values are returned; if `indices`, indices are returned; if `*`, both indices and values are returned (default: 'values')
- * @param predicate - predicate function specifying which group an element in the input collection belongs to
- * @param done - function to invoke upon completion
- * @throws must provide valid options
- *
- * @example
- * var readFile = require( '@stdlib/fs-read-file' );
- *
- * function done( error, result ) {
- * if ( error ) {
- * throw error;
- * }
- * console.log( result );
- * }
- *
- * function predicate( file, next ) {
- * var opts = {
- * 'encoding': 'utf8'
- * };
- * readFile( file, opts, onFile );
- *
- * function onFile( error ) {
- * if ( error ) {
- * return next( null, false );
- * }
- * next( null, true );
- * }
- * }
- *
- * var files = [
- * './beep.js',
- * './boop.js'
- * ];
- *
- * ns.bifurcateByAsync( files, predicate, done );
- */
- bifurcateByAsync: typeof bifurcateByAsync;
-
- /**
- * Function composition.
- *
- * ## Notes
- *
- * - Returns a composite function. Starting from the right, the composite function evaluates each function and passes the result as the first argument of the next function. The result of the leftmost function is the result of the whole.
- *
- * @param f0 - first function to compose
- * @param f1 - second function to compose
- * @param f - remaining functions to compose
- * @returns composite function
- *
- * @example
- * function a( x, next ) {
- * setTimeout( onTimeout, 0 );
- * function onTimeout() {
- * next( null, 2*x );
- * }
- * }
- *
- * function b( x, next ) {
- * setTimeout( onTimeout, 0 );
- * function onTimeout() {
- * next( null, x+3 );
- * }
- * }
- *
- * function c( x, next ) {
- * setTimeout( onTimeout, 0 );
- * function onTimeout() {
- * next( null, x/5 );
- * }
- * }
- *
- * var f = ns.composeAsync( c, b, a );
- *
- * function done( error, result ) {
- * if ( error ) {
- * throw error;
- * }
- * console.log( result );
- * // => 3
- * }
- *
- * f( 6, done );
- */
- composeAsync: typeof composeAsync;
-
- /**
- * Groups values according to an indicator function and returns group counts.
- *
- * ## Notes
- *
- * - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).
- *
- * @param collection - input collection
- * @param options - function options
- * @param options.thisArg - execution context
- * @param options.limit - maximum number of pending invocations at any one time
- * @param options.series - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection (default: false)
- * @param indicator - indicator function specifying which group an element in the input collection belongs to
- * @param done - function to invoke upon completion
- * @throws must provide valid options
- *
- * @example
- * var readFile = require( '@stdlib/fs-read-file' );
- *
- * function done( error, result ) {
- * if ( error ) {
- * throw error;
- * }
- * console.log( result );
- * }
- *
- * function indicator( file, next ) {
- * var opts = {
- * 'encoding': 'utf8'
- * };
- * readFile( file, opts, onFile );
- *
- * function onFile( error ) {
- * if ( error ) {
- * return next( null, 'nonreadable' );
- * }
- * next( null, 'readable' );
- * }
- * }
- *
- * var files = [
- * './beep.js',
- * './boop.js'
- * ];
- *
- * ns.countByAsync( files, indicator, done );
- */
- countByAsync: typeof countByAsync;
-
- /**
- * Invokes a function until a test condition is true.
- *
- * @param fcn - function to invoke
- * @param predicate - function which indicates whether to continue invoking a function
- * @param done - callback to invoke upon completion
- * @param thisArg - execution context for the invoked function
- *
- * @example
- * function fcn( i, next ) {
- * setTimeout( onTimeout, i );
- * function onTimeout() {
- * console.log( 'beep: %d', i );
- * next();
- * }
- * }
- *
- * function predicate( i, clbk ) {
- * clbk( null, i >= 5 );
- * }
- *
- * function done( error ) {
- * if ( error ) {
- * throw error;
- * }
- * }
- *
- * ns.doUntilAsync( fcn, predicate, done );
- */
- doUntilAsync: typeof doUntilAsync;
-
- /**
- * Invokes a function while a test condition is true.
- *
- * @param fcn - function to invoke
- * @param predicate - function which indicates whether to continue invoking a function
- * @param done - callback to invoke upon completion
- * @param thisArg - execution context for the invoked function
- *
- * @example
- * function fcn( i, next ) {
- * setTimeout( onTimeout, i );
- * function onTimeout() {
- * console.log( 'beep: %d', i );
- * next();
- * }
- * }
- *
- * function predicate( i, clbk ) {
- * clbk( null, i < 5 );
- * }
- *
- * function done( error ) {
- * if ( error ) {
- * throw error;
- * }
- * }
- *
- * ns.doWhileAsync( fcn, predicate, done );
- */
- doWhileAsync: typeof doWhileAsync;
-
- /**
- * Tests whether all elements in a collection pass a test implemented by a predicate function.
- *
- * ## Notes
- *
- * - If a predicate function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.
- * - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).
- *
- * @param collection - input collection
- * @param options - function options
- * @param options.thisArg - execution context
- * @param options.limit - maximum number of pending invocations at any one time
- * @param options.series - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection (default: false)
- * @param predicate - predicate function to invoke for each element in a collection
- * @param done - function to invoke upon completion
- * @throws must provide valid options
- *
- * @example
- * var readFile = require( '@stdlib/fs-read-file' );
- *
- * function done( error, bool ) {
- * if ( error ) {
- * throw error;
- * }
- * if ( bool ) {
- * console.log( 'Successfully read all files.' );
- * } else {
- * console.log( 'Was unable to read all files.' );
- * }
- * }
- *
- * function predicate( file, next ) {
- * var opts = {
- * 'encoding': 'utf8'
- * };
- * readFile( file, opts, onFile );
- *
- * function onFile( error ) {
- * if ( error ) {
- * return next( null, false );
- * }
- * next( null, true );
- * }
- * }
- *
- * var files = [
- * './beep.js',
- * './boop.js'
- * ];
- *
- * ns.everyByAsync( files, predicate, done );
- */
- everyByAsync: typeof everyByAsync;
-
- /**
- * Tests whether all elements in a collection pass a test implemented by a predicate function, iterating from right to left.
- *
- * ## Notes
- *
- * - If a predicate function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.
- * - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).
- *
- * @param collection - input collection
- * @param options - function options
- * @param options.thisArg - execution context
- * @param options.limit - maximum number of pending invocations at any one time
- * @param options.series - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection (default: false)
- * @param predicate - predicate function to invoke for each element in a collection
- * @param done - function to invoke upon completion
- * @throws must provide valid options
- *
- * @example
- * var readFile = require( '@stdlib/fs-read-file' );
- *
- * function done( error, bool ) {
- * if ( error ) {
- * throw error;
- * }
- * if ( bool ) {
- * console.log( 'Successfully read all files.' );
- * } else {
- * console.log( 'Was unable to read all files.' );
- * }
- * }
- *
- * function predicate( file, next ) {
- * var opts = {
- * 'encoding': 'utf8'
- * };
- * readFile( file, opts, onFile );
- *
- * function onFile( error ) {
- * if ( error ) {
- * return next( null, false );
- * }
- * next( null, true );
- * }
- * }
- *
- * var files = [
- * './beep.js',
- * './boop.js'
- * ];
- *
- * ns.everyByRightAsync( files, predicate, done );
- */
- everyByRightAsync: typeof everyByRightAsync;
-
- /**
- * Invokes a function once for each element in a collection.
- *
- * ## Notes
- *
- * - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.
- * - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).
- *
- * @param collection - input collection
- * @param options - function options
- * @param options.thisArg - execution context
- * @param options.limit - maximum number of pending invocations at any one time
- * @param options.series - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection (default: false)
- * @param fcn - function to invoke for each element in a collection
- * @param done - function to invoke upon completion
- * @throws must provide valid options
- *
- * @example
- * var readFile = require( '@stdlib/fs-read-file' );
- *
- * function done( error ) {
- * if ( error ) {
- * throw error;
- * }
- * console.log( 'Successfully read all files.' );
- * }
- *
- * function read( file, next ) {
- * var opts = {
- * 'encoding': 'utf8'
- * };
- * readFile( file, opts, onFile );
- *
- * function onFile( error ) {
- * if ( error ) {
- * return next( error );
- * }
- * console.log( 'Successfully read file: %s', file );
- * next();
- * }
- * }
- *
- * var files = [
- * './beep.js',
- * './boop.js'
- * ];
- *
- * ns.forEachAsync( files, read, done );
- */
- forEachAsync: typeof forEachAsync;
-
- /**
- * Invokes a function once for each element in a collection.
- *
- * ## Notes
- *
- * - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.
- * - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).
- *
- * @param collection - input collection
- * @param options - function options
- * @param options.thisArg - execution context
- * @param options.limit - maximum number of pending invocations at any one time
- * @param options.series - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection (default: false)
- * @param fcn - function to invoke for each element in a collection
- * @param done - function to invoke upon completion
- * @throws must provide valid options
- *
- * @example
- * var readFile = require( '@stdlib/fs-read-file' );
- *
- * function done( error ) {
- * if ( error ) {
- * throw error;
- * }
- * console.log( 'Successfully read all files.' );
- * }
- *
- * function read( file, next ) {
- * var opts = {
- * 'encoding': 'utf8'
- * };
- * readFile( file, opts, onFile );
- *
- * function onFile( error ) {
- * if ( error ) {
- * return next( error );
- * }
- * console.log( 'Successfully read file: %s', file );
- * next();
- * }
- * }
- *
- * var files = [
- * './beep.js',
- * './boop.js'
- * ];
- *
- * ns.forEachRightAsync( files, read, done );
- */
- forEachRightAsync: typeof forEachRightAsync;
-
- /**
- * Function sequence.
- *
- * @param f0 - first function to evaluate
- * @param f1 - second function to evaluate
- * @param f - remaining functions to evaluate in sequential order
- * @returns pipeline function
- *
- * @example
- * function a( x, next ) {
- * setTimeout( onTimeout, 0 );
- * function onTimeout() {
- * next( null, 2*x );
- * }
- * }
- *
- * function b( x, next ) {
- * setTimeout( onTimeout, 0 );
- * function onTimeout() {
- * next( null, x+3 );
- * }
- * }
- *
- * function c( x, next ) {
- * setTimeout( onTimeout, 0 );
- * function onTimeout() {
- * next( null, x/5 );
- * }
- * }
- *
- * var f = ns.functionSequenceAsync( a, b, c );
- *
- * function done( error, result ) {
- * if ( error ) {
- * throw error;
- * }
- * console.log( result );
- * // => 3
- * }
- *
- * f( 6, done );
- */
- functionSequenceAsync: typeof functionSequenceAsync;
-
- /**
- * Groups values according to an indicator function.
- *
- * ## Notes
- *
- * - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).
- *
- * @param collection - input collection
- * @param options - function options
- * @param options.thisArg - execution context
- * @param options.limit - maximum number of pending invocations at any one time
- * @param options.series - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection (default: false)
- * @param options.returns - if `values`, values are returned; if `indices`, indices are returned; if `*`, both indices and values are returned (default: 'values')
- * @param indicator - indicator function specifying which group an element in the input collection belongs to
- * @param done - function to invoke upon completion
- * @throws must provide valid options
- *
- * @example
- * var readFile = require( '@stdlib/fs-read-file' );
- *
- * function done( error, result ) {
- * if ( error ) {
- * throw error;
- * }
- * console.log( result );
- * }
- *
- * function indicator( file, next ) {
- * var opts = {
- * 'encoding': 'utf8'
- * };
- * readFile( file, opts, onFile );
- *
- * function onFile( error ) {
- * if ( error ) {
- * return next( null, 'nonreadable' );
- * }
- * next( null, 'readable' );
- * }
- * }
- *
- * var files = [
- * './beep.js',
- * './boop.js'
- * ];
- *
- * ns.groupByAsync( files, indicator, done );
- */
- groupByAsync: typeof groupByAsync;
-
- /**
- * If a predicate function returns a truthy value, returns `x`; otherwise, returns `y`.
- *
- * @param predicate - predicate function
- * @param x - value to return if a condition is truthy
- * @param y - value to return if a condition is falsy
- * @param done - callback to invoke upon completion
- *
- * @example
- * var randu = require( '@stdlib/random-base-randu' );
- *
- * function predicate( clbk ) {
- * setTimeout( onTimeout, 0 );
- * function onTimeout() {
- * clbk( null, randu() > 0.5 );
- * }
- * }
- *
- * function done( error, result ) {
- * if ( error ) {
- * throw error;
- * }
- * console.log( result );
- * }
- * ns.ifelseAsync( predicate, 1.0, -1.0, done );
- */
- ifelseAsync: typeof ifelseAsync;
-
- /**
- * If a predicate function returns a truthy value, invokes `x`; otherwise, invokes `y`.
- *
- * @param predicate - predicate function
- * @param x - function to invoke if a condition is truthy
- * @param y - function to invoke if a condition is falsy
- * @param done - callback to invoke upon completion
- *
- * @example
- * var randu = require( '@stdlib/random-base-randu' );
- *
- * function predicate( clbk ) {
- * setTimeout( onTimeout, 0 );
- * function onTimeout() {
- * clbk( null, randu() > 0.5 );
- * }
- * }
- *
- * function x( clbk ) {
- * setTimeout( onTimeout, 0 );
- * function onTimeout() {
- * clbk( null, 1.0 );
- * }
- * }
- *
- * function y( clbk ) {
- * setTimeout( onTimeout, 0 );
- * function onTimeout() {
- * clbk( null, -1.0 );
- * }
- * }
- *
- * function done( error, result ) {
- * if ( error ) {
- * throw error;
- * }
- * console.log( result );
- * }
- * ns.ifthenAsync( predicate, x, y, done );
- */
- ifthenAsync: typeof ifthenAsync;
-
- /**
- * Invokes a function once for each element in a collection and updates a collection in-place.
- *
- * ## Notes
- *
- * - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling. Note, however, that the function may have mutated an input collection during prior invocations, resulting in a partially mutated collection.
- * - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).
- *
- * @param collection - input collection
- * @param options - function options
- * @param options.thisArg - execution context
- * @param options.limit - maximum number of pending invocations at any one time
- * @param options.series - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection (default: false)
- * @param fcn - function to invoke for each element in a collection
- * @param done - function to invoke upon completion
- * @throws must provide valid options
- *
- * @example
- * var readFile = require( '@stdlib/fs-read-file' );
- *
- * function done( error, results ) {
- * if ( error ) {
- * throw error;
- * }
- * console.log( results );
- * }
- *
- * function read( file, next ) {
- * var opts = {
- * 'encoding': 'utf8'
- * };
- * readFile( file, opts, onFile );
- *
- * function onFile( error, data ) {
- * if ( error ) {
- * return next( error );
- * }
- * next( null, data );
- * }
- * }
- *
- * var files = [
- * './beep.js',
- * './boop.js'
- * ];
- *
- * ns.inmapAsync( files, read, done );
- */
- inmapAsync: typeof inmapAsync;
-
- /**
- * Invokes a function once for each element in a collection and updates a collection in-place.
- *
- * ## Notes
- *
- * - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling. Note, however, that the function may have mutated an input collection during prior invocations, resulting in a partially mutated collection.
- * - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).
- *
- * @param collection - input collection
- * @param options - function options
- * @param options.thisArg - execution context
- * @param options.limit - maximum number of pending invocations at any one time
- * @param options.series - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection (default: false)
- * @param fcn - function to invoke for each element in a collection
- * @param done - function to invoke upon completion
- * @throws must provide valid options
- *
- * @example
- * var readFile = require( '@stdlib/fs-read-file' );
- *
- * function done( error, results ) {
- * if ( error ) {
- * throw error;
- * }
- * console.log( results );
- * }
- *
- * function read( file, next ) {
- * var opts = {
- * 'encoding': 'utf8'
- * };
- * readFile( file, opts, onFile );
- *
- * function onFile( error, data ) {
- * if ( error ) {
- * return next( error );
- * }
- * next( null, data );
- * }
- * }
- *
- * var files = [
- * './beep.js',
- * './boop.js'
- * ];
- *
- * ns.inmapRightAsync( files, read, done );
- */
- inmapRightAsync: typeof inmapRightAsync;
-
- /**
- * Invokes a function `n` times and returns an array of accumulated function return values.
- *
- * ## Notes
- *
- * - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.
- * - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).
- *
- *
- * @param fcn - function to invoke
- * @param n - number of function invocations
- * @param options - function options
- * @param options.thisArg - execution context
- * @param options.limit - maximum number of pending invocations at any one time
- * @param options.series - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function again (default: false)
- * @param done - callback to invoke upon invoking a function `n` times
- * @throws second argument must be a nonnegative integer
- * @throws must provide valid options
- *
- * @example
- * function fcn( i, next ) {
- * setTimeout( onTimeout, i );
- * function onTimeout() {
- * next( null, i );
- * }
- * }
- *
- * function done( error, out ) {
- * if ( error ) {
- * throw error;
- * }
- * console.log( JSON.stringify( out ) );
- * // => [ 0, 1, 2, 3, 4 ]
- * }
- *
- * ns.mapFunAsync( fcn, 5, done );
- */
- mapFunAsync: typeof mapFunAsync;
-
- /**
- * Maps keys from one object to a new object having the same values.
- *
- * ## Notes
- *
- * - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.
- * - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).
- * - Iteration and insertion order are **not** guaranteed.
- * - The function only operates on own properties, not inherited properties.
- *
- *
- * @param obj - source object
- * @param options - function options
- * @param options.thisArg - execution context
- * @param options.limit - maximum number of pending invocations at any one time
- * @param options.series - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next own property (default: false)
- * @param transform - transform function
- * @param done - function to invoke upon completion
- * @throws must provide valid options
- *
- * @example
- * var readFile = require( '@stdlib/fs-read-file' );
- *
- * function read( key, value, next ) {
- * var opts = {
- * 'encoding': 'utf8'
- * };
- * readFile( value, opts, onFile );
- *
- * function onFile( error ) {
- * if ( error ) {
- * return next( null, key+':unreadable' );
- * }
- * next( null, key+':readable' );
- * }
- * }
- *
- * // Define a callback which handles errors:
- * function done( error, out ) {
- * if ( error ) {
- * throw error;
- * }
- * console.log( out );
- * }
- *
- * // Create a dictionary of file names:
- * var files = {
- * 'file1': './beep.js',
- * 'file2': './boop.js'
- * };
- *
- * var opts = {
- * 'series': true
- * };
- *
- * // Process each file in `files`:
- * ns.mapKeysAsync( files, opts, read, done );
- */
- mapKeysAsync: typeof mapKeysAsync;
-
- /**
- * Maps values from one object to a new object having the same keys.
- *
- * ## Notes
- *
- * - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.
- * - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).
- * - Iteration and insertion order are **not** guaranteed.
- * - The function only operates on own properties, not inherited properties.
- *
- *
- * @param obj - source object
- * @param options - function options
- * @param options.thisArg - execution context
- * @param options.limit - maximum number of pending invocations at any one time
- * @param options.series - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next own property (default: false)
- * @param transform - transform function
- * @param done - function to invoke upon completion
- * @throws must provide valid options
- *
- * @example
- * var stat = require( 'fs' ).stat;
- *
- * function getStats( file, next ) {
- * stat( file, onStats );
- *
- * function onStats( error, data ) {
- * if ( error ) {
- * return next( error );
- * }
- * next( null, data );
- * }
- * }
- *
- * // Define a callback which handles errors:
- * function done( error, out ) {
- * if ( error ) {
- * throw error;
- * }
- * console.log( out );
- * }
- *
- * // Create a dictionary of file names:
- * var files = {
- * 'file1': './beep.js',
- * 'file2': './boop.js'
- * };
- *
- * var opts = {
- * 'series': true
- * };
- *
- * // Process each file in `files`:
- * ns.mapValuesAsync( files, opts, getStats, done );
- */
- mapValuesAsync: typeof mapValuesAsync;
-
- /**
- * Tests whether all elements in a collection fail a test implemented by a predicate function.
- *
- * ## Notes
- *
- * - If a predicate function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.
- * - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).
- *
- * @param collection - input collection
- * @param options - function options
- * @param options.thisArg - execution context
- * @param options.limit - maximum number of pending invocations at any one time
- * @param options.series - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection (default: false)
- * @param predicate - predicate function to invoke for each element in a collection
- * @param done - function to invoke upon completion
- * @throws must provide valid options
- *
- * @example
- * var readFile = require( '@stdlib/fs-read-file' );
- *
- * function done( error, bool ) {
- * if ( error ) {
- * throw error;
- * }
- * if ( bool ) {
- * console.log( 'Was unable to read all files.' );
- * } else {
- * console.log( 'Was able to read at least one file.' );
- * }
- * }
- *
- * function predicate( file, next ) {
- * var opts = {
- * 'encoding': 'utf8'
- * };
- * readFile( file, opts, onFile );
- *
- * function onFile( error ) {
- * if ( error ) {
- * return next( null, false );
- * }
- * next( null, true );
- * }
- * }
- *
- * var files = [
- * './beep.js',
- * './boop.js'
- * ];
- *
- * ns.noneByAsync( files, predicate, done );
- */
- noneByAsync: typeof noneByAsync;
-
- /**
- * Tests whether all elements in a collection fail a test implemented by a predicate function, iterating from right to left.
- *
- * ## Notes
- *
- * - If a predicate function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.
- * - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).
- *
- * @param collection - input collection
- * @param options - function options
- * @param options.thisArg - execution context
- * @param options.limit - maximum number of pending invocations at any one time
- * @param options.series - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection (default: false)
- * @param predicate - predicate function to invoke for each element in a collection
- * @param done - function to invoke upon completion
- * @throws must provide valid options
- *
- * @example
- * var readFile = require( '@stdlib/fs-read-file' );
- *
- * function done( error, bool ) {
- * if ( error ) {
- * throw error;
- * }
- * if ( bool ) {
- * console.log( 'Was unable to read all files.' );
- * } else {
- * console.log( 'Was able to read at least one file.' );
- * }
- * }
- *
- * function predicate( file, next ) {
- * var opts = {
- * 'encoding': 'utf8'
- * };
- * readFile( file, opts, onFile );
- *
- * function onFile( error ) {
- * if ( error ) {
- * return next( null, false );
- * }
- * next( null, true );
- * }
- * }
- *
- * var files = [
- * './beep.js',
- * './boop.js'
- * ];
- *
- * ns.noneByRightAsync( files, predicate, done );
- */
- noneByRightAsync: typeof noneByRightAsync;
-
- /**
- * Applies a function against an accumulator and each element in a collection and return the accumulated result.
- *
- * ## Notes
- *
- * - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.
- * - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).
- *
- * @param collection - input collection
- * @param initial - initial value
- * @param options - function options
- * @param options.thisArg - execution context
- * @param options.limit - maximum number of pending invocations at any one time
- * @param options.series - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection (default: true)
- * @param reducer - function to invoke for each element in a collection
- * @param done - function to invoke upon completion
- * @throws must provide valid options
- *
- * @example
- * var readFile = require( '@stdlib/fs-read-file' );
- *
- * function done( error, acc ) {
- * if ( error ) {
- * throw error;
- * }
- * console.log( acc.count );
- * }
- *
- * function read( acc, file, next ) {
- * var opts = {
- * 'encoding': 'utf8'
- * };
- * readFile( file, opts, onFile );
- *
- * function onFile( error ) {
- * if ( error ) {
- * return next( null, acc );
- * }
- * acc.count += 1;
- * next( null, acc );
- * }
- * }
- *
- * var files = [
- * './beep.js',
- * './boop.js'
- * ];
- * var acc = {
- * 'count': 0
- * };
- * ns.reduceAsync( files, acc, read, done );
- */
- reduceAsync: typeof reduceAsync;
-
- /**
- * Applies a function against an accumulator and each element in a collection and return the accumulated result, iterating from right to left.
- *
- * ## Notes
- *
- * - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.
- * - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).
- *
- * @param collection - input collection
- * @param initial - initial value
- * @param options - function options
- * @param options.thisArg - execution context
- * @param options.limit - maximum number of pending invocations at any one time
- * @param options.series - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection (default: true)
- * @param reducer - function to invoke for each element in a collection
- * @param done - function to invoke upon completion
- * @throws must provide valid options
- *
- * @example
- * var readFile = require( '@stdlib/fs-read-file' );
- *
- * function done( error, acc ) {
- * if ( error ) {
- * throw error;
- * }
- * console.log( acc.count );
- * }
- *
- * function read( acc, file, next ) {
- * var opts = {
- * 'encoding': 'utf8'
- * };
- * readFile( file, opts, onFile );
- *
- * function onFile( error ) {
- * if ( error ) {
- * return next( null, acc );
- * }
- * acc.count += 1;
- * next( null, acc );
- * }
- * }
- *
- * var files = [
- * './beep.js',
- * './boop.js'
- * ];
- * var acc = {
- * 'count': 0
- * };
- * ns.reduceRightAsync( files, acc, read, done );
- */
- reduceRightAsync: typeof reduceRightAsync;
-
- /**
- * Executes functions in series, passing the results of one function as arguments to the next function.
- *
- * @param fcns - array of functions
- * @param clbk - callback to invoke upon completion
- * @param thisArg - function context
- *
- * @example
- * function foo( next ) {
- * next( null, 'beep' );
- * }
- *
- * function bar( str, next ) {
- * console.log( str );
- * // => 'beep'
- *
- * next();
- * }
- *
- * function done( error ) {
- * if ( error ) {
- * throw error;
- * }
- * }
- *
- * var fcns = [ foo, bar ];
- *
- * ns.waterfall( fcns, done );
- */
- waterfall: typeof waterfall;
-
- /**
- * Tests whether a collection contains at least `n` elements which pass a test implemented by a predicate function.
- *
- * ## Notes
- *
- * - If a predicate function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.
- * - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).
- *
- * @param collection - input collection
- * @param n - number of elements
- * @param options - function options
- * @param options.thisArg - execution context
- * @param options.limit - maximum number of pending invocations at any one time
- * @param options.series - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection (default: false)
- * @param predicate - predicate function to invoke for each element in a collection
- * @param done - function to invoke upon completion
- * @throws second argument must be a positive integer
- * @throws must provide valid options
- *
- * @example
- * var readFile = require( '@stdlib/fs-read-file' );
- *
- * function done( error, bool ) {
- * if ( error ) {
- * throw error;
- * }
- * if ( bool ) {
- * console.log( 'Successfully read some files.' );
- * } else {
- * console.log( 'Unable to read some files.' );
- * }
- * }
- *
- * function predicate( file, next ) {
- * var opts = {
- * 'encoding': 'utf8'
- * };
- * readFile( file, opts, onFile );
- *
- * function onFile( error ) {
- * if ( error ) {
- * return next( null, false );
- * }
- * next( null, true );
- * }
- * }
- *
- * var files = [
- * './beep.js',
- * './boop.js'
- * ];
- *
- * ns.someByAsync( files, 2, predicate, done );
- */
- someByAsync: typeof someByAsync;
-
- /**
- * Tests whether a collection contains at least `n` elements which pass a test implemented by a predicate function, iterating from right to left.
- *
- * ## Notes
- *
- * - If a predicate function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.
- * - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).
- *
- * @param collection - input collection
- * @param n - number of elements
- * @param options - function options
- * @param options.thisArg - execution context
- * @param options.limit - maximum number of pending invocations at any one time
- * @param options.series - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection (default: false)
- * @param predicate - predicate function to invoke for each element in a collection
- * @param done - function to invoke upon completion
- * @throws second argument must be a positive integer
- * @throws must provide valid options
- *
- * @example
- * var readFile = require( '@stdlib/fs-read-file' );
- *
- * function done( error, bool ) {
- * if ( error ) {
- * throw error;
- * }
- * if ( bool ) {
- * console.log( 'Successfully read some files.' );
- * } else {
- * console.log( 'Unable to read some files.' );
- * }
- * }
- *
- * function predicate( file, next ) {
- * var opts = {
- * 'encoding': 'utf8'
- * };
- * readFile( file, opts, onFile );
- *
- * function onFile( error ) {
- * if ( error ) {
- * return next( null, false );
- * }
- * next( null, true );
- * }
- * }
- *
- * var files = [
- * './beep.js',
- * './boop.js'
- * ];
- *
- * ns.someByRightAsync( files, 2, predicate, done );
- */
- someByRightAsync: typeof someByRightAsync;
-
- /**
- * Generates a frequency table according to an indicator function.
- *
- * ## Notes
- *
- * - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).
- *
- * - The output frequency table is an array of arrays. Each sub-array corresponds to a unique value in the input collection and is structured as follows:
- *
- * - 0: unique value
- * - 1: value count
- * - 2: frequency percentage
- *
- * @param collection - input collection
- * @param options - function options
- * @param options.thisArg - execution context
- * @param options.limit - maximum number of pending invocations at any one time
- * @param options.series - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection (default: false)
- * @param indicator - function whose return values are used to populate the output frequency table
- * @param done - function to invoke upon completion
- * @throws must provide valid options
- *
- * @example
- * var readFile = require( '@stdlib/fs-read-file' );
- *
- * function done( error, result ) {
- * if ( error ) {
- * throw error;
- * }
- * console.log( result );
- * }
- *
- * function indicator( file, next ) {
- * var opts = {
- * 'encoding': 'utf8'
- * };
- * readFile( file, opts, onFile );
- *
- * function onFile( error ) {
- * if ( error ) {
- * return next( null, 'nonreadable' );
- * }
- * next( null, 'readable' );
- * }
- * }
- *
- * var files = [
- * './beep.js',
- * './boop.js'
- * ];
- *
- * ns.tabulateByAsync( files, indicator, done );
- */
- tabulateByAsync: typeof tabulateByAsync;
-
- /**
- * If a function does not return an error, invokes a callback with the function result; otherwise, invokes a callback with a value `y`.
- *
- * @param x - function to invoke
- * @param y - value to return if `x` returns an error
- * @param done - callback to invoke upon completion
- *
- * @example
- * var randu = require( '@stdlib/random-base-randu' );
- *
- * function x( clbk ) {
- * setTimeout( onTimeout, 0 );
- * function onTimeout() {
- * if ( randu() > 0.5 ) {
- * return clbk( null, 1.0 );
- * }
- * clbk( new Error( 'beep' ) );
- * }
- * }
- *
- * function done( error, result ) {
- * if ( error ) {
- * console.log( error.message );
- * }
- * console.log( result );
- * }
- *
- * ns.trycatchAsync( x, -1.0, done );
- */
- trycatchAsync: typeof trycatchAsync;
-
- /**
- * If a function does not return an error, invokes a callback with the function result; otherwise, invokes a second function `y`.
- *
- * @param x - function to invoke
- * @param y - function to invoke if `x` returns an error
- * @param done - callback to invoke upon completion
- *
- * @example
- * var randu = require( '@stdlib/random-base-randu' );
- *
- * function x( clbk ) {
- * setTimeout( onTimeout, 0 );
- * function onTimeout() {
- * if ( randu() > 0.5 ) {
- * return clbk( null, 1.0 );
- * }
- * clbk( new Error( 'beep' ) );
- * }
- * }
- *
- * function y( clbk ) {
- * setTimeout( onTimeout, 0 );
- * function onTimeout() {
- * clbk( null, -1.0 );
- * }
- * }
- *
- * function done( error, result ) {
- * if ( error ) {
- * throw error;
- * }
- * console.log( result );
- * }
- *
- * ns.trythenAsync( x, y, done );
- */
- trythenAsync: typeof trythenAsync;
-
- /**
- * Invokes a function until a test condition is true.
- *
- * @param predicate - function which indicates whether to continue invoking a function
- * @param fcn - function to invoke
- * @param done - callback to invoke upon completion
- * @param thisArg - execution context for the invoked function
- *
- * @example
- * function predicate( i, clbk ) {
- * clbk( null, i >= 5 );
- * }
- *
- * function fcn( i, next ) {
- * setTimeout( onTimeout, i );
- * function onTimeout() {
- * console.log( 'beep: %d', i );
- * next();
- * }
- * }
- *
- * function done( error ) {
- * if ( error ) {
- * throw error;
- * }
- * }
- *
- * ns.untilAsync( predicate, fcn, done );
- */
- untilAsync: typeof untilAsync;
-
- /**
- * Invokes a function while a test condition is true.
- *
- * @param predicate - function which indicates whether to continue invoking a function
- * @param fcn - function to invoke
- * @param done - callback to invoke upon completion
- * @param thisArg - execution context for the invoked function
- *
- * @example
- * function predicate( i, clbk ) {
- * clbk( null, i < 5 );
- * }
- *
- * function fcn( i, next ) {
- * setTimeout( onTimeout, i );
- * function onTimeout() {
- * console.log( 'beep: %d', i );
- * next();
- * }
- * }
- *
- * function done( error ) {
- * if ( error ) {
- * throw error;
- * }
- * }
- *
- * ns.whileAsync( predicate, fcn, done );
- */
- whileAsync: typeof whileAsync;
-}
-
-/**
-* Standard async utilities.
-*/
-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 1c381c9..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 ns = require( './../lib' );
-
-console.log( objectKeys( ns ) );
diff --git a/index.js b/index.js
new file mode 100644
index 0000000..0f44d1b
--- /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,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self).ns=n()}(this,(function(){"use strict";var e="function"==typeof Object.defineProperty?Object.defineProperty:null;var n=Object.defineProperty;function t(e){return"number"==typeof e}function i(e){var n,t="";for(n=0;n0&&(n-=1),i=r.toExponential(n)):i=r.toPrecision(e.precision),e.alternate||(i=f.call(i,v,"$1e"),i=f.call(i,y,"e"),i=f.call(i,d,""));break;default:throw new Error("invalid double notation. Value: "+e.specifier)}return i=f.call(i,m,"e+0$1"),i=f.call(i,g,"e-0$1"),e.alternate&&(i=f.call(i,p,"$1."),i=f.call(i,h,"$1.e")),r>=0&&e.sign&&(i=e.sign+i),i=e.specifier===c.call(e.specifier)?c.call(i):a.call(i)}function w(e){var n,t="";for(n=0;n127)throw new Error("invalid character code. Value: "+i.arg);i.arg=A(l)?String(i.arg):E(l)}break;case"e":case"E":case"f":case"F":case"g":case"G":n||(i.precision=6),i.arg=b(i);break;default:throw new Error("invalid specifier: "+i.specifier)}i.maxWidth>=0&&i.arg.length>i.maxWidth&&(i.arg=i.arg.substring(0,i.maxWidth)),i.padZeros?i.arg=r(i.arg,i.width||i.precision,i.padRight):i.width&&(i.arg=(m=i.arg,g=i.width,p=i.padRight,h=void 0,(h=g-m.length)<0?m:m=p?m+w(h):w(h)+m)),u+=i.arg||"",a+=1}return u}var F=/%(?:([1-9]\d*)\$)?([0 +\-#]*)(\*|\d+)?(?:(\.)(\*|\d+)?)?[hlL]?([%A-Za-z])/g;function j(e){var n={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]&&(n.precision="1"),n}function C(e){var n,t,i,r;for(t=[],r=0,i=F.exec(e);i;)(n=e.slice(r,F.lastIndex-i[0].length)).length&&t.push(n),t.push(j(i)),r=F.lastIndex,i=F.exec(e);return(n=e.slice(r)).length&&t.push(n),t}function S(e){var n,t;if("string"!=typeof e)throw new TypeError(S("invalid argument. First argument must be a string. Value: `%s`.",e));for(n=[C(e)],t=1;t=0&&e.length<=ye}var be=Number.POSITIVE_INFINITY;var we,Ee=Object,Te=Object.getPrototypeOf;we=pe(Object.getPrototypeOf)?Te:function(e){var n=function(e){return e.__proto__}(e);return n||null===n?n:"[object Function]"===z(e.constructor)?e.constructor.prototype:e instanceof Object?Object.prototype:null};var Ae=we;var Oe=Object.prototype;function Ve(e){var n;return!!function(e){return"object"==typeof e&&null!==e&&!ce(e)}(e)&&(n=function(e){return null==e?null:(e=Ee(e),Ae(e))}(e),!n||!U(e,"constructor")&&U(n,"constructor")&&pe(n.constructor)&&"[object Function]"===z(n.constructor)&&U(n,"isPrototypeOf")&&pe(n.isPrototypeOf)&&(n===Oe||function(e){var n;for(n in e)if(!U(e,n))return!1;return!0}(e)))}function Fe(e){return"number"==typeof e}var je=Number,Ce=je.prototype.toString;var Se=G();function Ne(e){return"object"==typeof e&&(e instanceof je||(Se?function(e){try{return Ce.call(e),!0}catch(e){return!1}}(e):"[object Number]"===z(e)))}function Le(e){return Fe(e)||Ne(e)}R(Le,"isPrimitive",Fe),R(Le,"isObject",Ne);var Pe=je.NEGATIVE_INFINITY;function _e(e){return ePe&&de(e)}function ke(e){return Fe(e)&&_e(e)}function xe(e){return Ne(e)&&_e(e.valueOf())}function Je(e){return ke(e)||xe(e)}function Ie(e){return ke(e)&&e>0}function Be(e){return xe(e)&&e.valueOf()>0}function Re(e){return Ie(e)||Be(e)}function $e(e){if(e.__esModule)return e;var n=e.default;if("function"==typeof n){var t=function e(){return this instanceof e?Reflect.construct(n,arguments,this.constructor):n.apply(this,arguments)};t.prototype=n.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(e).forEach((function(n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})})),t}R(Je,"isPrimitive",ke),R(Je,"isObject",xe),R(Re,"isPrimitive",Ie),R(Re,"isObject",Be);var Me=$e(Object.freeze({__proto__:null,default:()=>()=>{}})),We=Me("any-by-async:limit");function Ge(e,n){var t,i,r;if(t={},arguments.length>1){if(i=function(e,n){return Ve(n)?(U(n,"thisArg")&&(e.thisArg=n.thisArg),U(n,"series")&&(e.series=n.series,!M(e.series))?new TypeError(S("invalid option. `%s` option must be a boolean. Option: `%s`.","series",e.series)):U(n,"limit")&&(e.limit=n.limit,!Ie(e.limit))?new TypeError(S("invalid option. `%s` option must be a positive integer. Option: `%s`.","limit",e.limit)):null):new TypeError(S("invalid argument. Options argument must be an object. Value: `%s`.",n))}(t,e),i)throw i;r=n}else r=e;if(!pe(r))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",r));return t.series?t.limit=1:t.limit||(t.limit=be),function(e,n){if(!ve(e))throw new TypeError(S("invalid argument. First argument must be a collection. Value: `%s`.",e));if(!pe(n))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",n));return function(e,n,t,i){var r,o,l,s,u,a,c;if(u=e.length,We("Collection length: %d",u),0===u)return We("Finished processing a collection."),i(null,!1);for(s=u1){if(i=function(e,n){return Ve(n)?(U(n,"thisArg")&&(e.thisArg=n.thisArg),U(n,"series")&&(e.series=n.series,!M(e.series))?new TypeError(S("invalid option. `%s` option must be a boolean. Option: `%s`.","series",e.series)):U(n,"limit")&&(e.limit=n.limit,!Ie(e.limit))?new TypeError(S("invalid option. `%s` option must be a positive integer. Option: `%s`.","limit",e.limit)):null):new TypeError(S("invalid argument. Options argument must be an object. Value: `%s`.",n))}(t,e),i)throw i;r=n}else r=e;if(!pe(r))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",r));return t.series?t.limit=1:t.limit||(t.limit=be),function(e,n){if(!ve(e))throw new TypeError(S("invalid argument. First argument must be a collection. Value: `%s`.",e));if(!pe(n))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",n));return function(e,n,t,i){var r,o,l,s,u,a;if(s=e.length,Ze("Collection length: %d",s),0===s)return Ze("Finished processing a collection."),i(null,!1);for(l=s0&&c();function c(){Ze("Collection element %d: %s.",u-=1,JSON.stringify(e[u])),2===t.length?t.call(n.thisArg,e[u],f):3===t.length?t.call(n.thisArg,e[u],u,f):t.call(n.thisArg,e[u],u,e,f)}function f(e,n){if(!o)return e?(o=!0,Ze("Encountered an error: %s",e.message),i(e)):(Ze("Processed %d of %d collection elements.",r+=1,s),Ze("Test result: %s",!!n),n&&!o?(o=!0,Ze("Finished processing a collection."),i(null,!0)):u>0?c():r===s?(Ze("Finished processing a collection."),i(null,!1)):void 0)}}(e,t,r,(function(e,t){if(e)return n(e,!1);n(null,t)}))}}function Ye(e,n,t,i){if(arguments.length<4)return Ue(n)(e,t);Ue(n,t)(e,i)}function qe(e){return e!=e}function ze(e){return Fe(e)&&qe(e)}function De(e){return Ne(e)&&qe(e.valueOf())}function He(e){return ze(e)||De(e)}function Ke(e){return"string"==typeof e}R(Ye,"factory",Ue),R(He,"isPrimitive",ze),R(He,"isObject",De);var Qe=String.prototype.valueOf;var en=G();function nn(e){return"object"==typeof e&&(e instanceof String||(en?function(e){try{return Qe.call(e),!0}catch(e){return!1}}(e):"[object String]"===z(e)))}function tn(e){return Ke(e)||nn(e)}function rn(e,n,t){var i,r;if(!ve(e)&&!Ke(e))throw new TypeError(S("invalid argument. First argument must be an array-like object. Value: `%s`.",e));if(0===(i=e.length))return-1;if(3===arguments.length){if(!ke(t))throw new TypeError(S("invalid argument. Third argument must be an integer. Value: `%s`.",t));if(t>=0){if(t>=i)return-1;r=t}else(r=i+t)<0&&(r=0)}else r=0;if(He(n)){for(;r1){if(i=function(e,n){return Ve(n)?(U(n,"thisArg")&&(e.thisArg=n.thisArg),U(n,"series")&&(e.series=n.series,!M(e.series))?new TypeError(S("invalid option. `%s` option must be a boolean. Option: `%s`.","series",e.series)):U(n,"limit")&&(e.limit=n.limit,!Ie(e.limit))?new TypeError(S("invalid option. `%s` option must be a positive integer. Option: `%s`.","limit",e.limit)):U(n,"returns")&&(e.returns=n.returns,-1===rn(on,e.returns))?new TypeError(S('invalid option. `%s` option must be one of the following: "%s". Option: `%s`.',"returns",on.join('", "'),e.returns)):null):new TypeError(S("invalid argument. Options argument must be an object. Value: `%s`.",n))}(t,e),i)throw i;r=n}else r=e;if(!pe(r))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",r));return t.series?t.limit=1:t.limit||(t.limit=be),function(e,n){if(!ve(e))throw new TypeError(S("invalid argument. First argument must be a collection. Value: `%s`.",e));if(!pe(n))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",n));return function(e,n,t,i){var r,o,l,s,u,a,c,f;if(u=e.length,ln("Collection length: %d",u),c=[],0===u)return ln("Finished processing a collection."),i(null,c);for(c.push([],[]),s=u1){if(i=function(e,n){return Ve(n)?(U(n,"thisArg")&&(e.thisArg=n.thisArg),U(n,"series")&&(e.series=n.series,!M(e.series))?new TypeError(S("invalid option. `%s` option must be a boolean. Option: `%s`.","series",e.series)):U(n,"limit")&&(e.limit=n.limit,!Ie(e.limit))?new TypeError(S("invalid option. `%s` option must be a positive integer. Option: `%s`.","limit",e.limit)):null):new TypeError(S("invalid argument. Options argument must be an object. Value: `%s`.",n))}(t,e),i)throw i;r=n}else r=e;if(!pe(r))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",r));return t.series?t.limit=1:t.limit||(t.limit=be),function(e,n){if(!ve(e))throw new TypeError(S("invalid argument. First argument must be a collection. Value: `%s`.",e));if(!pe(n))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",n));return function(e,n,t,i){var r,o,l,s,u,a,c,f;if(u=e.length,an("Collection length: %d",u),c={},0===u)return an("Finished processing a collection."),i(null,c);for(s=u1){if(i=function(e,n){return Ve(n)?(U(n,"thisArg")&&(e.thisArg=n.thisArg),U(n,"series")&&(e.series=n.series,!M(e.series))?new TypeError(S("invalid option. `%s` option must be a boolean. Option: `%s`.","series",e.series)):U(n,"limit")&&(e.limit=n.limit,!Ie(e.limit))?new TypeError(S("invalid option. `%s` option must be a positive integer. Option: `%s`.","limit",e.limit)):null):new TypeError(S("invalid argument. Options argument must be an object. Value: `%s`.",n))}(t,e),i)throw i;r=n}else r=e;if(!pe(r))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",r));return t.series?t.limit=1:t.limit||(t.limit=be),function(e,n){if(!ve(e))throw new TypeError(S("invalid argument. First argument must be a collection. Value: `%s`.",e));if(!pe(n))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",n));return function(e,n,t,i){var r,o,l,s,u,a,c;if(u=e.length,mn("Collection length: %d",u),0===u)return mn("Finished processing a collection."),i(null,!0);for(s=u1){if(i=function(e,n){return Ve(n)?(U(n,"thisArg")&&(e.thisArg=n.thisArg),U(n,"series")&&(e.series=n.series,!M(e.series))?new TypeError(S("invalid option. `%s` option must be a boolean. Option: `%s`.","series",e.series)):U(n,"limit")&&(e.limit=n.limit,!Ie(e.limit))?new TypeError(S("invalid option. `%s` option must be a positive integer. Option: `%s`.","limit",e.limit)):null):new TypeError(S("invalid argument. Options argument must be an object. Value: `%s`.",n))}(t,e),i)throw i;r=n}else r=e;if(!pe(r))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",r));return t.series?t.limit=1:t.limit||(t.limit=be),function(e,n){if(!ve(e))throw new TypeError(S("invalid argument. First argument must be a collection. Value: `%s`.",e));if(!pe(n))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",n));return function(e,n,t,i){var r,o,l,s,u,a;if(s=e.length,hn("Collection length: %d",s),0===s)return hn("Finished processing a collection."),i(null,!0);for(l=s0&&c();function c(){hn("Collection element %d: %s.",u-=1,JSON.stringify(e[u])),2===t.length?t.call(n.thisArg,e[u],f):3===t.length?t.call(n.thisArg,e[u],u,f):t.call(n.thisArg,e[u],u,e,f)}function f(e,n){if(!o)return e?(o=!0,hn("Encountered an error: %s",e.message),i(e)):(hn("Processed %d of %d collection elements.",r+=1,s),hn("Test result: %s",!!n),n||o?u>0?c():r===s?(hn("Finished processing a collection."),i(null,!0)):void 0:(o=!0,hn("Finished processing a collection."),i(null,!1)))}}(e,t,r,(function(e,t){if(e)return n(e,!1);n(null,t)}))}}function yn(e,n,t,i){if(arguments.length<4)return dn(n)(e,t);dn(n,t)(e,i)}R(yn,"factory",dn);var vn=Me("for-each-async:limit");function bn(e,n){var t,i,r;if(t={},arguments.length>1){if(i=function(e,n){return Ve(n)?(U(n,"thisArg")&&(e.thisArg=n.thisArg),U(n,"series")&&(e.series=n.series,!M(e.series))?new TypeError(S("invalid option. `%s` option must be a boolean. Option: `%s`.","series",e.series)):U(n,"limit")&&(e.limit=n.limit,!Ie(e.limit))?new TypeError(S("invalid option. `%s` option must be a positive integer. Option: `%s`.","limit",e.limit)):null):new TypeError(S("invalid argument. Options argument must be an object. Value: `%s`.",n))}(t,e),i)throw i;r=n}else r=e;if(!pe(r))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",r));return t.series?t.limit=1:t.limit||(t.limit=be),function(e,n){if(!ve(e))throw new TypeError(S("invalid argument. First argument must be a collection. Value: `%s`.",e));if(!pe(n))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",n));return function(e,n,t,i){var r,o,l,s,u,a,c;if(u=e.length,vn("Collection length: %d",u),0===u)return vn("Finished processing a collection."),i();for(s=u1){if(i=function(e,n){return Ve(n)?(U(n,"thisArg")&&(e.thisArg=n.thisArg),U(n,"series")&&(e.series=n.series,!M(e.series))?new TypeError(S("invalid option. `%s` option must be a boolean. Option: `%s`.","series",e.series)):U(n,"limit")&&(e.limit=n.limit,!Ie(e.limit))?new TypeError(S("invalid option. `%s` option must be a positive integer. Option: `%s`.","limit",e.limit)):null):new TypeError(S("invalid argument. Options argument must be an object. Value: `%s`.",n))}(t,e),i)throw i;r=n}else r=e;if(!pe(r))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",r));return t.series?t.limit=1:t.limit||(t.limit=be),function(e,n){if(!ve(e))throw new TypeError(S("invalid argument. First argument must be a collection. Value: `%s`.",e));if(!pe(n))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",n));return function(e,n,t,i){var r,o,l,s,u,a;if(s=e.length,En("Collection length: %d",s),0===s)return En("Finished processing a collection."),i();for(l=s0&&c();function c(){En("Collection element %d: %s.",u-=1,JSON.stringify(e[u])),2===t.length?t.call(n.thisArg,e[u],f):3===t.length?t.call(n.thisArg,e[u],u,f):t.call(n.thisArg,e[u],u,e,f)}function f(e){if(!o)return e?(o=!0,En("Encountered an error: %s",e.message),i(e)):(En("Processed %d of %d collection elements.",r+=1,s),u>0?c():r===s?(En("Finished processing a collection."),i()):void 0)}}(e,t,r,(function(e){if(e)return n(e);n()}))}}function An(e,n,t,i){if(arguments.length<4)return Tn(n)(e,t);Tn(n,t)(e,i)}R(An,"factory",Tn);var On=["values","indices","*"];var Vn=Me("group-by-async:limit");function Fn(e,n){var t,i,r;if(t={},arguments.length>1){if(i=function(e,n){return Ve(n)?(U(n,"thisArg")&&(e.thisArg=n.thisArg),U(n,"series")&&(e.series=n.series,!M(e.series))?new TypeError(S("invalid option. `%s` option must be a boolean. Option: `%s`.","series",e.series)):U(n,"limit")&&(e.limit=n.limit,!Ie(e.limit))?new TypeError(S("invalid option. `%s` option must be a positive integer. Option: `%s`.","limit",e.limit)):U(n,"returns")&&(e.returns=n.returns,-1===rn(On,e.returns))?new TypeError(S('invalid option. `%s` option must be one of the following: "%s". Option: `%s`.',"returns",On.join('", "'),e.returns)):null):new TypeError(S("invalid argument. Options argument must be an object. Value: `%s`.",n))}(t,e),i)throw i;r=n}else r=e;if(!pe(r))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",r));return t.series?t.limit=1:t.limit||(t.limit=be),function(e,n){if(!ve(e))throw new TypeError(S("invalid argument. First argument must be a collection. Value: `%s`.",e));if(!pe(n))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",n));return function(e,n,t,i){var r,o,l,s,u,a,c,f;if(u=e.length,Vn("Collection length: %d",u),c={},0===u)return Vn("Finished processing a collection."),i(null,c);for(s=u1){if(i=function(e,n){return Ve(n)?(U(n,"thisArg")&&(e.thisArg=n.thisArg),U(n,"series")&&(e.series=n.series,!M(e.series))?new TypeError(S("invalid option. `%s` option must be a boolean. Option: `%s`.","series",e.series)):U(n,"limit")&&(e.limit=n.limit,!Ie(e.limit))?new TypeError(S("invalid option. `%s` option must be a positive integer. Option: `%s`.","limit",e.limit)):null):new TypeError(S("invalid argument. Options argument must be an object. Value: `%s`.",n))}(t,e),i)throw i;r=n}else r=e;if(!pe(r))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",r));return t.series?t.limit=1:t.limit||(t.limit=be),function(e,n){if(!ve(e))throw new TypeError(S("invalid argument. First argument must be a collection. Value: `%s`.",e));if(!pe(n))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",n));return function(e,n,t,i){var r,o,l,s,u,a,c;if(u=e.length,Cn("Collection length: %d",u),0===u)return Cn("Finished processing a collection."),i();for(s=u1){if(i=function(e,n){return Ve(n)?(U(n,"thisArg")&&(e.thisArg=n.thisArg),U(n,"series")&&(e.series=n.series,!M(e.series))?new TypeError(S("invalid option. `%s` option must be a boolean. Option: `%s`.","series",e.series)):U(n,"limit")&&(e.limit=n.limit,!Ie(e.limit))?new TypeError(S("invalid option. `%s` option must be a positive integer. Option: `%s`.","limit",e.limit)):null):new TypeError(S("invalid argument. Options argument must be an object. Value: `%s`.",n))}(t,e),i)throw i;r=n}else r=e;if(!pe(r))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",r));return t.series?t.limit=1:t.limit||(t.limit=be),function(e,n){if(!ve(e))throw new TypeError(S("invalid argument. First argument must be a collection. Value: `%s`.",e));if(!pe(n))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",n));return function(e,n,t,i){var r,o,l,s,u,a;if(s=e.length,Ln("Collection length: %d",s),0===s)return Ln("Finished processing a collection."),i();for(l=s0&&c();function c(){var i;function r(n,t){if(!o){if(n)return o=!0,f(n);e[i]=t,f()}}Ln("Collection element %d: %s.",i=u-=1,JSON.stringify(e[i])),2===t.length?t.call(n.thisArg,e[i],r):3===t.length?t.call(n.thisArg,e[i],i,r):t.call(n.thisArg,e[i],i,e,r)}function f(e){return e?(Ln("Encountered an error: %s",e.message),i(e)):(Ln("Processed %d of %d collection elements.",r+=1,s),u>0?c():r===s?(Ln("Finished processing a collection."),i()):void 0)}}(e,t,r,(function(t){if(t)return n(t,e);n(null,e)}))}}function _n(e,n,t,i){if(arguments.length<4)return Pn(n)(e,t);Pn(n,t)(e,i)}function kn(e){return ke(e)&&e>=0}function xn(e){return xe(e)&&e.valueOf()>=0}function Jn(e){return kn(e)||xn(e)}R(_n,"factory",Pn),R(Jn,"isPrimitive",kn),R(Jn,"isObject",xn);var In=Me("map-function-async:limit");function Bn(e,n){var t,i,r;if(t={},arguments.length>1){if(i=function(e,n){return Ve(n)?(U(n,"thisArg")&&(e.thisArg=n.thisArg),U(n,"series")&&(e.series=n.series,!M(e.series))?new TypeError(S("invalid option. `%s` option must be a boolean. Option: `%s`.","series",e.series)):U(n,"limit")&&(e.limit=n.limit,!Ie(e.limit))?new TypeError(S("invalid option. `%s` option must be a positive integer. Option: `%s`.","limit",e.limit)):null):new TypeError(S("invalid argument. Options argument must be an object. Value: `%s`.",n))}(t,e),i)throw i;r=n}else r=e;if(!pe(r))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",r));return t.series?t.limit=1:t.limit||(t.limit=be),function(e,n){if(!kn(e))throw new TypeError(S("invalid argument. Number of function invocations must be a nonnegative integer. Value: `%s`.",e));if(!pe(n))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",n));return function(e,n,t,i){var r,o,l,s,u,a,c;if(In("Number of invocations: %d",e),l=new Array(e),0===e)return In("Finished invoking a function."),i(null,l);for(s=e=0&&n=0&&e.length<=4294967295&&U(e,"callee")&&!Yn(e,"callee")},zn=Array.prototype.slice;var Dn=Yn((function(){}),"prototype"),Hn=!Yn({toString:null},"toString");function Kn(e){return e.constructor&&e.constructor.prototype===e}var Qn=["console","external","frame","frameElement","frames","innerHeight","innerWidth","outerHeight","outerWidth","pageXOffset","pageYOffset","parent","scrollLeft","scrollTop","scrollX","scrollY","self","webkitIndexedDB","webkitStorageInfo","window"],et="undefined"==typeof window?void 0:window;var nt=function(){var e;if("undefined"===ge(et))return!1;for(e in et)try{-1===rn(Qn,e)&&U(et,e)&&null!==et[e]&&"object"===ge(et[e])&&Kn(et[e])}catch(e){return!0}return!1}(),tt="undefined"!=typeof window;var it,rt=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"];it=Wn?function(){return 2!==($n(arguments)||"").length}(1,2)?function(e){return qn(e)?$n(zn.call(e)):$n(e)}:$n:function(e){var n,t,i,r,o,l,s;if(r=[],qn(e)){for(s=0;s0&&!U(e,"0"))for(s=0;s1){if(i=function(e,n){return Ve(n)?(U(n,"thisArg")&&(e.thisArg=n.thisArg),U(n,"series")&&(e.series=n.series,!M(e.series))?new TypeError(S("invalid option. `%s` option must be a boolean. Option: `%s`.","series",e.series)):U(n,"limit")&&(e.limit=n.limit,!Ie(e.limit))?new TypeError(S("invalid option. `%s` option must be a positive integer. Option: `%s`.","limit",e.limit)):null):new TypeError(S("invalid argument. Options argument must be an object. Value: `%s`.",n))}(t,e),i)throw i;r=n}else r=e;if(!pe(r))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",r));return t.series?t.limit=1:t.limit||(t.limit=be),function(e,n){if("object"!=typeof e||null===e)throw new TypeError(S("invalid argument. First argument must be an object. Value: `%s`.",e));if(!pe(n))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",n));return function(e,n,t,i){var r,o,l,s,u,a,c,f,m;if(l=ot(e),a=l.length,lt("Number of keys: %d",a),f={},0===a)return lt("Finished processing an object."),i(null,f);for(u=a %s: %s",n,JSON.stringify(i)),f[n]=i,p()}}r=l[c+=1],i=e[r],lt("%s: %s",r,JSON.stringify(i)),2===t.length?t.call(n.thisArg,r,o):3===t.length?t.call(n.thisArg,r,i,o):t.call(n.thisArg,r,i,e,o)}function p(e){return e?(lt("Encountered an error: %s",e.message),i(e)):(lt("Processed %d of %d properties.",o+=1,a),c1){if(i=function(e,n){return Ve(n)?(U(n,"thisArg")&&(e.thisArg=n.thisArg),U(n,"series")&&(e.series=n.series,!M(e.series))?new TypeError(S("invalid option. `%s` option must be a boolean. Option: `%s`.","series",e.series)):U(n,"limit")&&(e.limit=n.limit,!Ie(e.limit))?new TypeError(S("invalid option. `%s` option must be a positive integer. Option: `%s`.","limit",e.limit)):null):new TypeError(S("invalid argument. Options argument must be an object. Value: `%s`.",n))}(t,e),i)throw i;r=n}else r=e;if(!pe(r))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",r));return t.series?t.limit=1:t.limit||(t.limit=be),function(e,n){if("object"!=typeof e||null===e)throw new TypeError(S("invalid argument. First argument must be an object. Value: `%s`.",e));if(!pe(n))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",n));return function(e,n,t,i){var r,o,l,s,u,a,c,f,m;if(l=ot(e),a=l.length,at("Number of keys: %d",a),f={},0===a)return at("Finished processing an object."),i(null,f);for(u=a %s: %s",i,JSON.stringify(n)),f[i]=n,p()}}i=l[c+=1],at("%s: %s",i,JSON.stringify(e[i])),2===t.length?t.call(n.thisArg,e[i],r):3===t.length?t.call(n.thisArg,e[i],i,r):t.call(n.thisArg,e[i],i,e,r)}function p(e){return e?(at("Encountered an error: %s",e.message),i(e)):(at("Processed %d of %d properties.",o+=1,a),c1){if(i=function(e,n){return Ve(n)?(U(n,"thisArg")&&(e.thisArg=n.thisArg),U(n,"series")&&(e.series=n.series,!M(e.series))?new TypeError(S("invalid option. `%s` option must be a boolean. Option: `%s`.","series",e.series)):U(n,"limit")&&(e.limit=n.limit,!Ie(e.limit))?new TypeError(S("invalid option. `%s` option must be a positive integer. Option: `%s`.","limit",e.limit)):null):new TypeError(S("invalid argument. Options argument must be an object. Value: `%s`.",n))}(t,e),i)throw i;r=n}else r=e;if(!pe(r))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",r));return t.series?t.limit=1:t.limit||(t.limit=be),function(e,n){if(!ve(e))throw new TypeError(S("invalid argument. First argument must be a collection. Value: `%s`.",e));if(!pe(n))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",n));return function(e,n,t,i){var r,o,l,s,u,a,c;if(u=e.length,mt("Collection length: %d",u),0===u)return mt("Finished processing a collection."),i(null,!0);for(s=u1){if(i=function(e,n){return Ve(n)?(U(n,"thisArg")&&(e.thisArg=n.thisArg),U(n,"series")&&(e.series=n.series,!M(e.series))?new TypeError(S("invalid option. `%s` option must be a boolean. Option: `%s`.","series",e.series)):U(n,"limit")&&(e.limit=n.limit,!Ie(e.limit))?new TypeError(S("invalid option. `%s` option must be a positive integer. Option: `%s`.","limit",e.limit)):null):new TypeError(S("invalid argument. Options argument must be an object. Value: `%s`.",n))}(t,e),i)throw i;r=n}else r=e;if(!pe(r))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",r));return t.series?t.limit=1:t.limit||(t.limit=be),function(e,n){if(!ve(e))throw new TypeError(S("invalid argument. First argument must be a collection. Value: `%s`.",e));if(!pe(n))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",n));return function(e,n,t,i){var r,o,l,s,u,a;if(s=e.length,ht("Collection length: %d",s),0===s)return ht("Finished processing a collection."),i(null,!0);for(l=s0&&c();function c(){ht("Collection element %d: %s.",u-=1,JSON.stringify(e[u])),2===t.length?t.call(n.thisArg,e[u],f):3===t.length?t.call(n.thisArg,e[u],u,f):t.call(n.thisArg,e[u],u,e,f)}function f(e,n){if(!o)return e?(o=!0,ht("Encountered an error: %s",e.message),i(e)):(ht("Processed %d of %d collection elements.",r+=1,s),ht("Test result: %s",!!n),n&&!o?(o=!0,ht("Finished processing a collection."),i(null,!1)):u>0?c():r===s?(ht("Finished processing a collection."),i(null,!0)):void 0)}}(e,t,r,(function(e,t){if(e)return n(e,!1);n(null,t)}))}}function yt(e,n,t,i){if(arguments.length<4)return dt(n)(e,t);dt(n,t)(e,i)}R(yt,"factory",dt);var vt=Me("reduce-async:limit");function bt(e,n){var t,i,r;if(t={},arguments.length>1){if(i=function(e,n){return Ve(n)?(U(n,"thisArg")&&(e.thisArg=n.thisArg),U(n,"series")&&(e.series=n.series,!M(e.series))?new TypeError(S("invalid option. `%s` option must be a boolean. Option: `%s`.","series",e.series)):U(n,"limit")&&(e.limit=n.limit,!Ie(e.limit))?new TypeError(S("invalid option. `%s` option must be a positive integer. Option: `%s`.","limit",e.limit)):null):new TypeError(S("invalid argument. Options argument must be an object. Value: `%s`.",n))}(t,e),i)throw i;r=n}else r=e;if(!pe(r))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",r));return void 0===t.series&&void 0===t.limit&&(t.series=!0),t.series?t.limit=1:t.limit||(t.limit=be),function(e,n,i){if(!ve(e))throw new TypeError(S("invalid argument. First argument must be a collection. Value: `%s`.",e));if(!pe(i))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",i));return function(e,n,t,i,r){var o,l,s,u,a,c,f;if(a=e.length,vt("Collection length: %d",a),0===a)return vt("Finished processing a collection."),r(null,n);for(u=a1){if(i=function(e,n){return Ve(n)?(U(n,"thisArg")&&(e.thisArg=n.thisArg),U(n,"series")&&(e.series=n.series,!M(e.series))?new TypeError(S("invalid option. `%s` option must be a boolean. Option: `%s`.","series",e.series)):U(n,"limit")&&(e.limit=n.limit,!Ie(e.limit))?new TypeError(S("invalid option. `%s` option must be a positive integer. Option: `%s`.","limit",e.limit)):null):new TypeError(S("invalid argument. Options argument must be an object. Value: `%s`.",n))}(t,e),i)throw i;r=n}else r=e;if(!pe(r))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",r));return void 0===t.series&&void 0===t.limit&&(t.series=!0),t.series?t.limit=1:t.limit||(t.limit=be),function(e,n,i){if(!ve(e))throw new TypeError(S("invalid argument. First argument must be a collection. Value: `%s`.",e));if(!pe(i))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",i));return function(e,n,t,i,r){var o,l,s,u,a,c;if(u=e.length,Et("Collection length: %d",u),0===u)return Et("Finished processing a collection."),r(null,n);for(s=u0&&f();function f(){function r(e,t){if(!l){if(e)return l=!0,m(e);Et("Accumulator: %s",JSON.stringify(t)),n=t,m()}}Et("Collection element %d: %s.",a-=1,JSON.stringify(e[a])),3===i.length?i.call(t.thisArg,n,e[a],r):4===i.length?i.call(t.thisArg,n,e[a],a,r):i.call(t.thisArg,n,e[a],a,e,r)}function m(e){return e?(Et("Encountered an error: %s",e.message),r(e)):(Et("Processed %d of %d collection elements.",o+=1,u),a>0?f():o===u?(Et("Finished processing a collection."),r(null,n)):void 0)}}(e,n,t,r,(function(e,n){if(e)return i(e);i(null,n)}))}}function At(e,n,t,i,r){if(arguments.length<5)return Tt(t)(e,n,i);Tt(t,i)(e,n,r)}R(At,"factory",Tt);var Ot=4294967295;var Vt=function(e){if("function"!=typeof e)throw new TypeError(S("invalid argument. Must provide a function. Value: `%s`.",e));return function(n){var t,i;if(!function(e){return null!=e&&"function"!=typeof e&&"number"==typeof e.length&&de(e.length)&&e.length>=0&&e.length<=Ot}(n))return!1;if(0===(t=n.length))return!1;for(i=0;i=e.length)return n();for(l=arguments.length,o=new Array(l),s=0;s1){if(i=function(e,n){return Ve(n)?(U(n,"thisArg")&&(e.thisArg=n.thisArg),U(n,"series")&&(e.series=n.series,!M(e.series))?new TypeError(S("invalid option. `%s` option must be a boolean. Option: `%s`.","series",e.series)):U(n,"limit")&&(e.limit=n.limit,!Ie(e.limit))?new TypeError(S("invalid option. `%s` option must be a positive integer. Option: `%s`.","limit",e.limit)):null):new TypeError(S("invalid argument. Options argument must be an object. Value: `%s`.",n))}(t,e),i)throw i;r=n}else r=e;if(!pe(r))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",r));return t.series?t.limit=1:t.limit||(t.limit=be),function(e,n,i){if(!ve(e))throw new TypeError(S("invalid argument. First argument must be a collection. Value: `%s`.",e));if(!Ie(n))throw new TypeError(S("invalid argument. Second argument must be a positive integer. Value: `%s`.",n));if(!pe(i))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",i));return function(e,n,t,i,r){var o,l,s,u,a,c,f,m;if(a=e.length,Ct("Collection length: %d",a),0===a)return Ct("Finished processing a collection."),r(null,!1);for(u=a1){if(i=function(e,n){return Ve(n)?(U(n,"thisArg")&&(e.thisArg=n.thisArg),U(n,"series")&&(e.series=n.series,!M(e.series))?new TypeError(S("invalid option. `%s` option must be a boolean. Option: `%s`.","series",e.series)):U(n,"limit")&&(e.limit=n.limit,!Ie(e.limit))?new TypeError(S("invalid option. `%s` option must be a positive integer. Option: `%s`.","limit",e.limit)):null):new TypeError(S("invalid argument. Options argument must be an object. Value: `%s`.",n))}(t,e),i)throw i;r=n}else r=e;if(!pe(r))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",r));return t.series?t.limit=1:t.limit||(t.limit=be),function(e,n,i){if(!ve(e))throw new TypeError(S("invalid argument. First argument must be a collection. Value: `%s`.",e));if(!Ie(n))throw new TypeError(S("invalid argument. Second argument must be a positive integer. Value: `%s`.",n));if(!pe(i))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",i));return function(e,n,t,i,r){var o,l,s,u,a,c,f;if(u=e.length,Lt("Collection length: %d",u),0===u)return Lt("Finished processing a collection."),r(null,!1);for(s=u0&&m();function m(){Lt("Collection element %d: %s.",a-=1,JSON.stringify(e[a])),2===i.length?i.call(t.thisArg,e[a],g):3===i.length?i.call(t.thisArg,e[a],a,g):i.call(t.thisArg,e[a],a,e,g)}function g(e,t){if(!l)return e?(l=!0,Lt("Encountered an error: %s",e.message),r(e)):(Lt("Processed %d of %d collection elements.",o+=1,u),Lt("Test result: %s",!!t),t&&!l&&(c+=1)===n?(l=!0,Lt("Finished processing a collection."),r(null,!0)):a>0?m():o===u?(Lt("Finished processing a collection."),r(null,!1)):void 0)}}(e,n,t,r,(function(e,n){if(e)return i(e,!1);i(null,n)}))}}function _t(e,n,t,i,r){if(arguments.length<5)return Pt(t)(e,n,i);Pt(t,i)(e,n,r)}R(_t,"factory",Pt);var kt=Me("tabulate-by-async:limit");function xt(e,n){var t,i,r;if(t={},arguments.length>1){if(i=function(e,n){return Ve(n)?(U(n,"thisArg")&&(e.thisArg=n.thisArg),U(n,"series")&&(e.series=n.series,!M(e.series))?new TypeError(S("invalid option. `%s` option must be a boolean. Option: `%s`.","series",e.series)):U(n,"limit")&&(e.limit=n.limit,!Ie(e.limit))?new TypeError(S("invalid option. `%s` option must be a positive integer. Option: `%s`.","limit",e.limit)):null):new TypeError(S("invalid argument. Options argument must be an object. Value: `%s`.",n))}(t,e),i)throw i;r=n}else r=e;if(!pe(r))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",r));return t.series?t.limit=1:t.limit||(t.limit=be),function(e,n){if(!ve(e))throw new TypeError(S("invalid argument. First argument must be a collection. Value: `%s`.",e));if(!pe(n))throw new TypeError(S("invalid argument. Last argument must be a function. Value: `%s`.",n));return function(e,n,t,i){var r,o,l,s,u,a,c,f,m;if(u=e.length,kt("Collection length: %d",u),c=[],0===u)return kt("Finished processing a collection."),i(null,c);for(f=[],s=u1)for(r=new Array(arguments.length-1),i=1;i1)for(r=new Array(arguments.length-1),i=1;i1)for(r=new Array(arguments.length-1),i=1;i1)for(r=new Array(arguments.length-1),i=1;i 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 getGlobal from '@stdlib/utils-global';\n\n\n// MAIN //\n\nvar root = getGlobal();\nvar nodeList = root.document && root.document.childNodes;\n\n\n// EXPORTS //\n\nexport default nodeList;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isBoolean } from '@stdlib/assert-is-boolean';\nimport format from '@stdlib/string-format';\nimport getThis from './codegen.js';\nimport Self from './self.js';\nimport Win from './window.js';\nimport Global from './global.js';\nimport GlobalThis from './global_this.js';\n\n\n// MAIN //\n\n/**\n* Returns the global object.\n*\n* ## Notes\n*\n* - Using code generation is the **most** reliable way to resolve the global object; however, doing so is likely to violate content security policies (CSPs) in, e.g., Chrome Apps and elsewhere.\n*\n* @param {boolean} [codegen=false] - boolean indicating whether to use code generation to resolve the global object\n* @throws {TypeError} must provide a boolean\n* @throws {Error} unable to resolve global object\n* @returns {Object} global object\n*\n* @example\n* var g = getGlobal();\n* // returns {...}\n*/\nfunction getGlobal( codegen ) {\n\tif ( arguments.length ) {\n\t\tif ( !isBoolean( codegen ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Must provide a boolean. Value: `%s`.', codegen ) );\n\t\t}\n\t\tif ( codegen ) {\n\t\t\treturn getThis();\n\t\t}\n\t\t// Fall through...\n\t}\n\t// Case: 2020 revision of ECMAScript standard\n\tif ( GlobalThis ) {\n\t\treturn GlobalThis;\n\t}\n\t// Case: browsers and web workers\n\tif ( Self ) {\n\t\treturn Self;\n\t}\n\t// Case: browsers\n\tif ( Win ) {\n\t\treturn Win;\n\t}\n\t// Case: Node.js\n\tif ( Global ) {\n\t\treturn Global;\n\t}\n\t// Case: unknown\n\tthrow new Error( 'unexpected error. Unable to resolve global object.' );\n}\n\n\n// EXPORTS //\n\nexport default getGlobal;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Returns the global object using code generation.\n*\n* @private\n* @returns {Object} global object\n*/\nfunction getGlobal() {\n\treturn new Function( 'return this;' )(); // eslint-disable-line no-new-func, stdlib/require-globals\n}\n\n\n// EXPORTS //\n\nexport default getGlobal;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\nvar typedarray = Int8Array; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default typedarray;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Returns a regular expression to capture everything that is not a space immediately after the `function` keyword and before the first left parenthesis.\n*\n* @returns {RegExp} regular expression\n*\n* @example\n* var RE_FUNCTION_NAME = reFunctionName();\n*\n* function fname( fcn ) {\n* return RE_FUNCTION_NAME.exec( fcn.toString() )[ 1 ];\n* }\n*\n* var fn = fname( Math.sqrt );\n* // returns 'sqrt'\n*\n* fn = fname( Int8Array );\n* // returns 'Int8Array'\n*\n* fn = fname( Object.prototype.toString );\n* // returns 'toString'\n*\n* fn = fname( function(){} );\n* // returns ''\n*/\nfunction reFunctionName() {\n\treturn /^\\s*function\\s*([^(]*)/i;\n}\n\n\n// EXPORTS //\n\nexport default reFunctionName;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport reFunctionName from './main.js';\n\n\n// MAIN //\n\n/**\n* Captures everything that is not a space immediately after the `function` keyword and before the first left parenthesis.\n*\n* Regular expression: `/^\\s*function\\s*([^(]*)/i`\n*\n* - `/^\\s*`\n* - Match zero or more spaces at beginning\n*\n* - `function`\n* - Match the word `function`\n*\n* - `\\s*`\n* - Match zero or more spaces after the word `function`\n*\n* - `()`\n* - Capture\n*\n* - `[^(]*`\n* - Match anything except a left parenthesis `(` zero or more times\n*\n* - `/i`\n* - ignore case\n*\n* @constant\n* @type {RegExp}\n* @default /^\\s*function\\s*([^(]*)/i\n*/\nvar RE_FUNCTION_NAME = reFunctionName();\n\n\n// EXPORTS //\n\nexport default RE_FUNCTION_NAME;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Regular expression to capture everything that is not a space immediately after the `function` keyword and before the first left parenthesis.\n*\n* @module @stdlib/regexp-function-name\n*\n* @example\n* import reFunctionName from '@stdlib/regexp-function-name';\n* var RE_FUNCTION_NAME = reFunctionName();\n*\n* function fname( fcn ) {\n* return RE_FUNCTION_NAME.exec( fcn.toString() )[ 1 ];\n* }\n*\n* var fn = fname( Math.sqrt );\n* // returns 'sqrt'\n*\n* fn = fname( Int8Array );\n* // returns 'Int8Array'\n*\n* fn = fname( Object.prototype.toString );\n* // returns 'toString'\n*\n* fn = fname( function(){} );\n* // returns ''\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport REGEXP from './regexp.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'REGEXP', REGEXP );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar f;\n\n\n// FUNCTIONS //\n\n/**\n* Tests if a value is an array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an array\n*\n* @example\n* var bool = isArray( [] );\n* // returns true\n*\n* @example\n* var bool = isArray( {} );\n* // returns false\n*/\nfunction isArray( value ) {\n\treturn ( nativeClass( value ) === '[object Array]' );\n}\n\n\n// MAIN //\n\nif ( Array.isArray ) {\n\tf = Array.isArray;\n} else {\n\tf = isArray;\n}\n\n\n// EXPORTS //\n\nexport default f;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Tests if a value is object-like.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is object-like\n*\n* @example\n* var bool = isObjectLike( {} );\n* // returns true\n*\n* @example\n* var bool = isObjectLike( [] );\n* // returns true\n*\n* @example\n* var bool = isObjectLike( null );\n* // returns false\n*/\nfunction isObjectLike( value ) {\n\treturn (\n\t\tvalue !== null &&\n\t\ttypeof value === 'object'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isObjectLike;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\nimport { REGEXP as RE } from '@stdlib/regexp-function-name';\nimport isBuffer from '@stdlib/assert-is-buffer';\n\n\n// MAIN //\n\n/**\n* Determines the name of a value's constructor.\n*\n* @param {*} v - input value\n* @returns {string} name of a value's constructor\n*\n* @example\n* var v = constructorName( 'a' );\n* // returns 'String'\n*\n* @example\n* var v = constructorName( 5 );\n* // returns 'Number'\n*\n* @example\n* var v = constructorName( null );\n* // returns 'Null'\n*\n* @example\n* var v = constructorName( undefined );\n* // returns 'Undefined'\n*\n* @example\n* var v = constructorName( function noop() {} );\n* // returns 'Function'\n*/\nfunction constructorName( v ) {\n\tvar match;\n\tvar name;\n\tvar ctor;\n\tname = nativeClass( v ).slice( 8, -1 );\n\tif ( (name === 'Object' || name === 'Error') && v.constructor ) {\n\t\tctor = v.constructor;\n\t\tif ( typeof ctor.name === 'string' ) {\n\t\t\treturn ctor.name;\n\t\t}\n\t\tmatch = RE.exec( ctor.toString() );\n\t\tif ( match ) {\n\t\t\treturn match[ 1 ];\n\t\t}\n\t}\n\tif ( isBuffer( v ) ) {\n\t\treturn 'Buffer';\n\t}\n\treturn name;\n}\n\n\n// EXPORTS //\n\nexport default constructorName;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isObjectLike from '@stdlib/assert-is-object-like';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Buffer instance.\n*\n* @param {*} value - value to validate\n* @returns {boolean} boolean indicating if a value is a Buffer instance\n*\n* @example\n* var v = isBuffer( new Buffer( 'beep' ) );\n* // returns true\n*\n* @example\n* var v = isBuffer( new Buffer( [1,2,3,4] ) );\n* // returns true\n*\n* @example\n* var v = isBuffer( {} );\n* // returns false\n*\n* @example\n* var v = isBuffer( [] );\n* // returns false\n*/\nfunction isBuffer( value ) {\n\treturn (\n\t\tisObjectLike( value ) &&\n\t\t(\n\t\t\t// eslint-disable-next-line no-underscore-dangle\n\t\t\tvalue._isBuffer || // for envs missing Object.prototype.constructor (e.g., Safari 5-7)\n\t\t\t(\n\t\t\t\tvalue.constructor &&\n\n\t\t\t\t// WARNING: `typeof` is not a foolproof check, as certain envs consider RegExp and NodeList instances to be functions\n\t\t\t\ttypeof value.constructor.isBuffer === 'function' &&\n\t\t\t\tvalue.constructor.isBuffer( value )\n\t\t\t)\n\t\t)\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isBuffer;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\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/**\n* Determine a value's type.\n*\n* @module @stdlib/utils-type-of\n*\n* @example\n* import typeOf from '@stdlib/utils-type-of';\n*\n* var str = typeOf( 'a' );\n* // returns 'string'\n*\n* str = typeOf( 5 );\n* // returns 'number'\n*/\n\n// MODULES //\n\nimport usePolyfill from './check.js';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main = ( usePolyfill() ) ? polyfill : builtin;\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport RE from './fixtures/re.js';\nimport nodeList from './fixtures/nodelist.js';\nimport typedarray from './fixtures/typedarray.js';\n\n\n// MAIN //\n\n/**\n* Checks whether a polyfill is needed when using the `typeof` operator.\n*\n* @private\n* @returns {boolean} boolean indicating whether a polyfill is needed\n*/\nfunction check() {\n\tif (\n\t\t// Chrome 1-12 returns 'function' for regular expression instances (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof):\n\t\ttypeof RE === 'function' ||\n\n\t\t// Safari 8 returns 'object' for typed array and weak map constructors (underscore #1929):\n\t\ttypeof typedarray === 'object' ||\n\n\t\t// PhantomJS 1.9 returns 'function' for `NodeList` instances (underscore #2236):\n\t\ttypeof nodeList === 'function'\n\t) {\n\t\treturn true;\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nexport default check;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport ctorName from '@stdlib/utils-constructor-name';\n\n\n// MAIN //\n\n/**\n* Determines a value's type.\n*\n* @param {*} v - input value\n* @returns {string} string indicating the value's type\n*/\nfunction typeOf( v ) {\n\treturn ctorName( v ).toLowerCase();\n}\n\n\n// EXPORTS //\n\nexport default typeOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport ctorName from '@stdlib/utils-constructor-name';\n\n\n// NOTES //\n\n/*\n* Built-in `typeof` operator behavior:\n*\n* ```text\n* typeof null => 'object'\n* typeof undefined => 'undefined'\n* typeof 'a' => 'string'\n* typeof 5 => 'number'\n* typeof NaN => 'number'\n* typeof true => 'boolean'\n* typeof false => 'boolean'\n* typeof {} => 'object'\n* typeof [] => 'object'\n* typeof function foo(){} => 'function'\n* typeof function* foo(){} => 'object'\n* typeof Symbol() => 'symbol'\n* ```\n*\n*/\n\n\n// MAIN //\n\n/**\n* Determines a value's type.\n*\n* @param {*} v - input value\n* @returns {string} string indicating the value's type\n*/\nfunction typeOf( v ) {\n\tvar type;\n\n\t// Address `typeof null` => `object` (see http://wiki.ecmascript.org/doku.php?id=harmony:typeof_null):\n\tif ( v === null ) {\n\t\treturn 'null';\n\t}\n\ttype = typeof v;\n\n\t// If the `typeof` operator returned something other than `object`, we are done. Otherwise, we need to check for an internal class name or search for a constructor.\n\tif ( type === 'object' ) {\n\t\treturn ctorName( v ).toLowerCase();\n\t}\n\treturn type;\n}\n\n\n// EXPORTS //\n\nexport default typeOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport typeOf from '@stdlib/utils-type-of';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a function.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a function\n*\n* @example\n* function beep() {\n* return 'beep';\n* }\n*\n* var bool = isFunction( beep );\n* // returns true\n*/\nfunction isFunction( value ) {\n\t// Note: cannot use `typeof` directly, as various browser engines incorrectly return `'function'` when operating on non-function objects, such as regular expressions and NodeLists.\n\treturn ( typeOf( value ) === 'function' );\n}\n\n\n// EXPORTS //\n\nexport default isFunction;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// 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/**\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/**\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) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Returns an object.\n*\n* @name Object\n* @constructor\n* @type {Function}\n* @param {*} value - input value\n* @returns {Object} object\n*\n* @example\n* var o = new Object( null );\n* // returns {}\n*\n* @example\n* var o = new Object( 5.0 );\n* // returns \n*\n* @example\n* var o = new Object( 'beep' );\n* // returns \n*\n* @example\n* var o1 = {};\n*\n* var o2 = new Object( o1 );\n* // returns {}\n*\n* var bool = ( o1 === o2 );\n* // returns true\n*/\nvar Obj = Object; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Obj;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isFunction from '@stdlib/assert-is-function';\nimport builtin from './native.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar getProto;\nif ( isFunction( Object.getPrototypeOf ) ) {\n\tgetProto = builtin;\n} else {\n\tgetProto = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default getProto;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\nvar getProto = Object.getPrototypeOf;\n\n\n// EXPORTS //\n\nexport default getProto;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport nativeClass from '@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 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 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/**\n* Tests if a value is a number primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number primitive\n*\n* @example\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* @example\n* var bool = isNumber( NaN );\n* // returns true\n*\n* @example\n* var bool = isNumber( new Number( 3.14 ) );\n* // returns false\n*/\nfunction isNumber( value ) {\n\treturn ( typeof value === 'number' );\n}\n\n\n// EXPORTS //\n\nexport default isNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// EXPORTS //\n\nexport default Number; // eslint-disable-line stdlib/require-globals\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Number from '@stdlib/number-ctor';\n\n\n// MAIN //\n\n// eslint-disable-next-line stdlib/no-redeclare\nvar toString = Number.prototype.toString; // non-generic\n\n\n// EXPORTS //\n\nexport default toString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport nativeClass from '@stdlib/utils-native-class';\nimport Number from '@stdlib/number-ctor';\nimport test from './try2serialize.js';\n\n\n// VARIABLES //\n\nvar FLG = hasToStringTag();\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object\n*\n* @example\n* var bool = isNumber( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isNumber( new Number( 3.14 ) );\n* // returns true\n*/\nfunction isNumber( value ) {\n\tif ( typeof value === 'object' ) {\n\t\tif ( value instanceof Number ) {\n\t\t\treturn true;\n\t\t}\n\t\tif ( FLG ) {\n\t\t\treturn test( value );\n\t\t}\n\t\treturn ( nativeClass( value ) === '[object Number]' );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nexport default isNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport toString from './tostring.js'; // eslint-disable-line stdlib/no-redeclare\n\n\n// MAIN //\n\n/**\n* Attempts to serialize a value to a string.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value can be serialized\n*/\nfunction test( value ) {\n\ttry {\n\t\ttoString.call( value );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isPrimitive from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a number\n*\n* @example\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* @example\n* var bool = isNumber( new Number( 3.14 ) );\n* // returns true\n*\n* @example\n* var bool = isNumber( NaN );\n* // returns true\n*\n* @example\n* var bool = isNumber( null );\n* // returns false\n*/\nfunction isNumber( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nexport default isNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Test if a value is a number.\n*\n* @module @stdlib/assert-is-number\n*\n* @example\n* import isNumber from '@stdlib/assert-is-number';\n*\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* bool = isNumber( new Number( 3.14 ) );\n* // returns true\n*\n* bool = isNumber( NaN );\n* // returns true\n*\n* bool = isNumber( null );\n* // returns false\n*\n* @example\n* import { isPrimitive as isNumber } from '@stdlib/assert-is-number';\n*\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* bool = isNumber( NaN );\n* // returns true\n*\n* bool = isNumber( new Number( 3.14 ) );\n* // returns false\n*\n* @example\n* import { isObject as isNumber } from '@stdlib/assert-is-number';\n*\n* var bool = isNumber( 3.14 );\n* // returns false\n*\n* bool = isNumber( new Number( 3.14 ) );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport isPrimitive from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'isPrimitive', isPrimitive );\nsetReadOnly( main, 'isObject', isObject );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Double-precision floating-point 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// MODULES //\n\nimport PINF from '@stdlib/constants-float64-pinf';\nimport NINF from '@stdlib/constants-float64-ninf';\nimport isInt from '@stdlib/math-base-assert-is-integer';\n\n\n// MAIN //\n\n/**\n* Tests if a number primitive is an integer value.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a number primitive is an integer value\n*/\nfunction isInteger( value ) {\n\treturn (\n\t\tvalue < PINF &&\n\t\tvalue > NINF &&\n\t\tisInt( value )\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isNumber } from '@stdlib/assert-is-number';\nimport isInt from './integer.js';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number primitive having an integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number primitive having an integer value\n*\n* @example\n* var bool = isInteger( -3.0 );\n* // returns true\n*\n* @example\n* var bool = isInteger( new Number( -3.0 ) );\n* // returns false\n*/\nfunction isInteger( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tisInt( value )\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isObject as isNumber } from '@stdlib/assert-is-number';\nimport isInt from './integer.js';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object having an integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object having an integer value\n*\n* @example\n* var bool = isInteger( 3.0 );\n* // returns false\n*\n* @example\n* var bool = isInteger( new Number( 3.0 ) );\n* // returns true\n*/\nfunction isInteger( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tisInt( value.valueOf() )\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isPrimitive from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\n/**\n* Tests if a value is an integer.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an integer\n*\n* @example\n* var bool = isInteger( 5.0 );\n* // returns true\n*\n* @example\n* var bool = isInteger( new Number( 5.0 ) );\n* // returns true\n*\n* @example\n* var bool = isInteger( -3.14 );\n* // returns false\n*\n* @example\n* var bool = isInteger( null );\n* // returns false\n*/\nfunction isInteger( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nexport default isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isInteger } from '@stdlib/assert-is-integer';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number primitive having a positive integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number primitive having a positive integer value\n*\n* @example\n* var bool = isPositiveInteger( 3.0 );\n* // returns true\n*\n* @example\n* var bool = isPositiveInteger( new Number( 3.0 ) );\n* // returns false\n*/\nfunction isPositiveInteger( value ) {\n\treturn (\n\t\tisInteger( value ) &&\n\t\tvalue > 0.0\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isPositiveInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isObject as isInteger } from '@stdlib/assert-is-integer';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object having a positive integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object having a positive integer value\n*\n* @example\n* var bool = isPositiveInteger( 3.0 );\n* // returns false\n*\n* @example\n* var bool = isPositiveInteger( new Number( 3.0 ) );\n* // returns true\n*/\nfunction isPositiveInteger( value ) {\n\treturn (\n\t\tisInteger( value ) &&\n\t\tvalue.valueOf() > 0.0\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isPositiveInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isPrimitive from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a positive integer.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a positive integer\n*\n* @example\n* var bool = isPositiveInteger( 5.0 );\n* // returns true\n*\n* @example\n* var bool = isPositiveInteger( new Number( 5.0 ) );\n* // returns true\n*\n* @example\n* var bool = isPositiveInteger( 0.0 );\n* // returns false\n*\n* @example\n* var bool = isPositiveInteger( -5.0 );\n* // returns false\n*\n* @example\n* var bool = isPositiveInteger( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isPositiveInteger( null );\n* // returns false\n*/\nfunction isPositiveInteger( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nexport default isPositiveInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Test if a value is an integer.\n*\n* @module @stdlib/assert-is-integer\n*\n* @example\n* import isInteger from '@stdlib/assert-is-integer';\n*\n* var bool = isInteger( 5.0 );\n* // returns true\n*\n* bool = isInteger( new Number( 5.0 ) );\n* // returns true\n*\n* bool = isInteger( -3.14 );\n* // returns false\n*\n* bool = isInteger( null );\n* // returns false\n*\n* @example\n* // Use interface to check for integer primitives...\n* import { isPrimitive as isInteger } from '@stdlib/assert-is-integer';\n*\n* var bool = isInteger( -3.0 );\n* // returns true\n*\n* bool = isInteger( new Number( -3.0 ) );\n* // returns false\n*\n* @example\n* // Use interface to check for integer objects...\n* import { isObject as isInteger } from '@stdlib/assert-is-integer';\n*\n* var bool = isInteger( 3.0 );\n* // returns false\n*\n* bool = isInteger( new Number( 3.0 ) );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport isPrimitive from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'isPrimitive', isPrimitive );\nsetReadOnly( main, 'isObject', isObject );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Test if a value is a positive integer.\n*\n* @module @stdlib/assert-is-positive-integer\n*\n* @example\n* import isPositiveInteger from '@stdlib/assert-is-positive-integer';\n*\n* var bool = isPositiveInteger( 5.0 );\n* // returns true\n*\n* bool = isPositiveInteger( new Number( 5.0 ) );\n* // returns true\n*\n* bool = isPositiveInteger( -5.0 );\n* // returns false\n*\n* bool = isPositiveInteger( 3.14 );\n* // returns false\n*\n* bool = isPositiveInteger( null );\n* // returns false\n*\n* @example\n* import { isPrimitive as isPositiveInteger } from '@stdlib/assert-is-positive-integer';\n*\n* var bool = isPositiveInteger( 3.0 );\n* // returns true\n*\n* bool = isPositiveInteger( new Number( 3.0 ) );\n* // returns false\n*\n* @example\n* import { isObject as isPositiveInteger } from '@stdlib/assert-is-positive-integer';\n*\n* var bool = isPositiveInteger( 3.0 );\n* // returns false\n*\n* bool = isPositiveInteger( new Number( 3.0 ) );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport isPrimitive from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'isPrimitive', isPrimitive );\nsetReadOnly( main, 'isObject', isObject );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'any-by-async:limit' );\n\n\n// MAIN //\n\n/**\n* Invokes a predicate function once for each element in a collection, limiting the number of concurrently pending functions.\n*\n* @private\n* @param {Collection} collection - input collection\n* @param {Options} opts - function options\n* @param {*} [opts.thisArg] - execution context\n* @param {PositiveInteger} [opts.limit] - maximum number of pending function invocations\n* @param {Function} predicate - predicate function\n* @param {Callback} done - function to invoke upon completion or upon encountering an error\n* @returns {void}\n*/\nfunction limit( collection, opts, predicate, done ) {\n\tvar maxIndex;\n\tvar count;\n\tvar flg;\n\tvar lim;\n\tvar len;\n\tvar idx;\n\tvar i;\n\n\tlen = collection.length;\n\tdebug( 'Collection length: %d', len );\n\n\tif ( len === 0 ) {\n\t\tdebug( 'Finished processing a collection.' );\n\t\treturn done( null, false );\n\t}\n\tif ( len < opts.limit ) {\n\t\tlim = len;\n\t} else {\n\t\tlim = opts.limit;\n\t}\n\tdebug( 'Concurrency limit: %d', lim );\n\tdebug( 'Number of arguments: %d', predicate.length );\n\n\tmaxIndex = len - 1;\n\tcount = 0;\n\tidx = -1;\n\tfor ( i = 0; i < lim; i++ ) {\n\t\t// This guard is necessary to protect against synchronous functions which exhaust all collection elements...\n\t\tif ( idx < maxIndex ) {\n\t\t\tnext(); // eslint-disable-line node/callback-return\n\t\t}\n\t}\n\n\t/**\n\t* Callback to invoke a provided function for the next element in a collection.\n\t*\n\t* @private\n\t*/\n\tfunction next() {\n\t\tidx += 1;\n\t\tdebug( 'Collection element %d: %s.', idx, JSON.stringify( collection[ idx ] ) );\n\t\tif ( predicate.length === 2 ) {\n\t\t\tpredicate.call( opts.thisArg, collection[ idx ], clbk );\n\t\t} else if ( predicate.length === 3 ) {\n\t\t\tpredicate.call( opts.thisArg, collection[ idx ], idx, clbk );\n\t\t} else {\n\t\t\tpredicate.call( opts.thisArg, collection[ idx ], idx, collection, clbk ); // eslint-disable-line max-len\n\t\t}\n\t}\n\n\t/**\n\t* Callback invoked once a provided function finishes processing a collection element.\n\t*\n\t* @private\n\t* @param {*} [error] - error\n\t* @param {*} [result] - test result\n\t* @returns {void}\n\t*/\n\tfunction clbk( error, result ) {\n\t\tif ( flg ) {\n\t\t\t// Prevent further processing of collection elements:\n\t\t\treturn;\n\t\t}\n\t\tif ( error ) {\n\t\t\tflg = true;\n\t\t\tdebug( 'Encountered an error: %s', error.message );\n\t\t\treturn done( error );\n\t\t}\n\t\tcount += 1;\n\t\tdebug( 'Processed %d of %d collection elements.', count, len );\n\n\t\tdebug( 'Test result: %s', !!result );\n\t\tif ( result && !flg ) {\n\t\t\tflg = true;\n\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\treturn done( null, true );\n\t\t}\n\t\tif ( idx < maxIndex ) {\n\t\t\treturn next();\n\t\t}\n\t\tif ( count === len ) {\n\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\treturn done( null, false );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default limit;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isCollection from '@stdlib/assert-is-collection';\nimport format from '@stdlib/string-format';\nimport PINF from '@stdlib/constants-float64-pinf';\nimport validate from './validate.js';\nimport limit from './limit.js';\n\n\n// MAIN //\n\n/**\n* Returns a function for testing whether at least one element in a collection passes a test implemented by a predicate function.\n*\n* ## Notes\n*\n* - If a predicate function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} predicate - predicate function to invoke for each element in a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} last argument must be a function\n* @returns {Function} function which invokes the predicate function once for each element in a collection\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* var opts = {\n* 'series': true\n* };\n*\n* // Create a `anyByAsync` function which invokes the predicate function for each collection element sequentially:\n* var anyByAsync = factory( opts, predicate );\n*\n* // Create a collection over which to iterate:\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* // Define a callback which handles results:\n* function done( error, bool ) {\n* if ( error ) {\n* throw error;\n* }\n* if ( bool ) {\n* console.log( 'Successfully read at least one file.' );\n* } else {\n* console.log( 'Unable to read any files.' );\n* }\n* }\n*\n* // Try to read each element in `files`:\n* anyByAsync( files, done );\n*/\nfunction factory( options, predicate ) {\n\tvar opts;\n\tvar err;\n\tvar f;\n\n\topts = {};\n\tif ( arguments.length > 1 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t\tf = predicate;\n\t} else {\n\t\tf = options;\n\t}\n\tif ( !isFunction( f ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', f ) );\n\t}\n\tif ( opts.series ) {\n\t\topts.limit = 1;\n\t} else if ( !opts.limit ) {\n\t\topts.limit = PINF;\n\t}\n\treturn anyByAsync;\n\n\t/**\n\t* Invokes a predicate function for each element in a collection.\n\t*\n\t* @private\n\t* @param {Collection} collection - input collection\n\t* @param {Callback} done - function to invoke upon completion\n\t* @throws {TypeError} first argument must be a collection\n\t* @throws {TypeError} last argument must be a function\n\t* @returns {void}\n\t*/\n\tfunction anyByAsync( collection, done ) {\n\t\tif ( !isCollection( collection ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a collection. Value: `%s`.', collection ) );\n\t\t}\n\t\tif ( !isFunction( done ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t\t}\n\t\treturn limit( collection, opts, f, clbk );\n\n\t\t/**\n\t\t* Callback invoked upon completion.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {boolean} bool - test result\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction clbk( error, bool ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error, false );\n\t\t\t}\n\t\t\tdone( null, bool );\n\t\t}\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 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 isPositiveInteger } from '@stdlib/assert-is-positive-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 {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'thisArg': {},\n* 'series': false,\n* 'limit': 10\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, 'thisArg' ) ) {\n\t\topts.thisArg = options.thisArg;\n\t}\n\tif ( hasOwnProp( options, 'series' ) ) {\n\t\topts.series = options.series;\n\t\tif ( !isBoolean( opts.series ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'series', opts.series ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'limit' ) ) {\n\t\topts.limit = options.limit;\n\t\tif ( !isPositiveInteger( opts.limit ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport factory from './factory.js';\n\n\n// MAIN //\n\n/**\n* Tests whether at least one element in a collection passes a test implemented by a predicate function.\n*\n* ## Notes\n*\n* - If a predicate function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Collection} collection - input collection\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} predicate - predicate function to invoke for each element in a collection\n* @param {Callback} done - function to invoke upon completion\n* @throws {TypeError} first argument must be a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} second-to-last argument must be a function\n* @throws {TypeError} last argument must be a function\n* @returns {void}\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function done( error, bool ) {\n* if ( error ) {\n* throw error;\n* }\n* if ( bool ) {\n* console.log( 'Successfully read at least one file.' );\n* } else {\n* console.log( 'Unable to read any files.' );\n* }\n* }\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* anyByAsync( files, predicate, done );\n*/\nfunction anyByAsync( collection, options, predicate, done ) {\n\tif ( arguments.length < 4 ) {\n\t\treturn factory( options )( collection, predicate );\n\t}\n\tfactory( options, predicate )( collection, done );\n}\n\n\n// EXPORTS //\n\nexport default anyByAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\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 whether at least one element in a collection passes a test implemented by a predicate function.\n*\n* @module @stdlib/utils-async-any-by\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n* import anyByAsync from '@stdlib/utils-async-any-by';\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* function done( error, bool ) {\n* if ( error ) {\n* throw error;\n* }\n* if ( bool ) {\n* console.log( 'Successfully read at least one file.' );\n* } else {\n* console.log( 'Unable to read any files.' );\n* }\n* }\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* anyByAsync( files, predicate, done );\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'any-by-right-async:limit' );\n\n\n// MAIN //\n\n/**\n* Invokes a predicate function once for each element in a collection, limiting the number of concurrently pending functions and iterating from right to left.\n*\n* @private\n* @param {Collection} collection - input collection\n* @param {Options} opts - function options\n* @param {*} [opts.thisArg] - execution context\n* @param {PositiveInteger} [opts.limit] - maximum number of pending function invocations\n* @param {Function} predicate - predicate function\n* @param {Callback} done - function to invoke upon completion or upon encountering an error\n* @returns {void}\n*/\nfunction limit( collection, opts, predicate, done ) {\n\tvar count;\n\tvar flg;\n\tvar lim;\n\tvar len;\n\tvar idx;\n\tvar i;\n\n\tlen = collection.length;\n\tdebug( 'Collection length: %d', len );\n\n\tif ( len === 0 ) {\n\t\tdebug( 'Finished processing a collection.' );\n\t\treturn done( null, false );\n\t}\n\tif ( len < opts.limit ) {\n\t\tlim = len;\n\t} else {\n\t\tlim = opts.limit;\n\t}\n\tdebug( 'Concurrency limit: %d', lim );\n\tdebug( 'Number of arguments: %d', predicate.length );\n\n\tcount = 0;\n\tidx = len;\n\tfor ( i = 0; i < lim; i++ ) {\n\t\t// This guard is necessary to protect against synchronous functions which exhaust all collection elements...\n\t\tif ( idx > 0 ) {\n\t\t\tnext(); // eslint-disable-line node/callback-return\n\t\t}\n\t}\n\n\t/**\n\t* Callback to invoke a provided function for the next element in a collection.\n\t*\n\t* @private\n\t*/\n\tfunction next() {\n\t\tidx -= 1;\n\t\tdebug( 'Collection element %d: %s.', idx, JSON.stringify( collection[ idx ] ) );\n\t\tif ( predicate.length === 2 ) {\n\t\t\tpredicate.call( opts.thisArg, collection[ idx ], clbk );\n\t\t} else if ( predicate.length === 3 ) {\n\t\t\tpredicate.call( opts.thisArg, collection[ idx ], idx, clbk );\n\t\t} else {\n\t\t\tpredicate.call( opts.thisArg, collection[ idx ], idx, collection, clbk ); // eslint-disable-line max-len\n\t\t}\n\t}\n\n\t/**\n\t* Callback invoked once a provided function finishes processing a collection element.\n\t*\n\t* @private\n\t* @param {*} [error] - error\n\t* @param {*} [result] - test result\n\t* @returns {void}\n\t*/\n\tfunction clbk( error, result ) {\n\t\tif ( flg ) {\n\t\t\t// Prevent further processing of collection elements:\n\t\t\treturn;\n\t\t}\n\t\tif ( error ) {\n\t\t\tflg = true;\n\t\t\tdebug( 'Encountered an error: %s', error.message );\n\t\t\treturn done( error );\n\t\t}\n\t\tcount += 1;\n\t\tdebug( 'Processed %d of %d collection elements.', count, len );\n\n\t\tdebug( 'Test result: %s', !!result );\n\t\tif ( result && !flg ) {\n\t\t\tflg = true;\n\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\treturn done( null, true );\n\t\t}\n\t\tif ( idx > 0 ) {\n\t\t\treturn next();\n\t\t}\n\t\tif ( count === len ) {\n\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\treturn done( null, false );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default limit;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isCollection from '@stdlib/assert-is-collection';\nimport format from '@stdlib/string-format';\nimport PINF from '@stdlib/constants-float64-pinf';\nimport validate from './validate.js';\nimport limit from './limit.js';\n\n\n// MAIN //\n\n/**\n* Returns a function for testing whether at least one element in a collection passes a test implemented by a predicate function, iterating from right to left.\n*\n* ## Notes\n*\n* - If a predicate function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} predicate - predicate function to invoke for each element in a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} last argument must be a function\n* @returns {Function} function which invokes the predicate function once for each element in a collection\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* var opts = {\n* 'series': true\n* };\n*\n* // Create a `anyByRightAsync` function which invokes the predicate function for each collection element sequentially:\n* var anyByRightAsync = factory( opts, predicate );\n*\n* // Create a collection over which to iterate:\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* // Define a callback which handles results:\n* function done( error, bool ) {\n* if ( error ) {\n* throw error;\n* }\n* if ( bool ) {\n* console.log( 'Successfully read at least one file.' );\n* } else {\n* console.log( 'Unable to read any files.' );\n* }\n* }\n*\n* // Try to read each element in `files`:\n* anyByRightAsync( files, done );\n*/\nfunction factory( options, predicate ) {\n\tvar opts;\n\tvar err;\n\tvar f;\n\n\topts = {};\n\tif ( arguments.length > 1 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t\tf = predicate;\n\t} else {\n\t\tf = options;\n\t}\n\tif ( !isFunction( f ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', f ) );\n\t}\n\tif ( opts.series ) {\n\t\topts.limit = 1;\n\t} else if ( !opts.limit ) {\n\t\topts.limit = PINF;\n\t}\n\treturn anyByRightAsync;\n\n\t/**\n\t* Invokes a predicate function for each element in a collection, iterating from right to left.\n\t*\n\t* @private\n\t* @param {Collection} collection - input collection\n\t* @param {Callback} done - function to invoke upon completion\n\t* @throws {TypeError} first argument must be a collection\n\t* @throws {TypeError} last argument must be a function\n\t* @returns {void}\n\t*/\n\tfunction anyByRightAsync( collection, done ) {\n\t\tif ( !isCollection( collection ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a collection. Value: `%s`.', collection ) );\n\t\t}\n\t\tif ( !isFunction( done ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t\t}\n\t\treturn limit( collection, opts, f, clbk );\n\n\t\t/**\n\t\t* Callback invoked upon completion.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {boolean} bool - test result\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction clbk( error, bool ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error, false );\n\t\t\t}\n\t\t\tdone( null, bool );\n\t\t}\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 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 isPositiveInteger } from '@stdlib/assert-is-positive-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 {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'thisArg': {},\n* 'series': false,\n* 'limit': 10\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, 'thisArg' ) ) {\n\t\topts.thisArg = options.thisArg;\n\t}\n\tif ( hasOwnProp( options, 'series' ) ) {\n\t\topts.series = options.series;\n\t\tif ( !isBoolean( opts.series ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'series', opts.series ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'limit' ) ) {\n\t\topts.limit = options.limit;\n\t\tif ( !isPositiveInteger( opts.limit ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport factory from './factory.js';\n\n\n// MAIN //\n\n/**\n* Tests whether at least one element in a collection passes a test implemented by a predicate function, iterating from right to left.\n*\n* ## Notes\n*\n* - If a predicate function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Collection} collection - input collection\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} predicate - predicate function to invoke for each element in a collection\n* @param {Callback} done - function to invoke upon completion\n* @throws {TypeError} first argument must be a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} second-to-last argument must be a function\n* @throws {TypeError} last argument must be a function\n* @returns {void}\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function done( error, bool ) {\n* if ( error ) {\n* throw error;\n* }\n* if ( bool ) {\n* console.log( 'Successfully read at least one file.' );\n* } else {\n* console.log( 'Unable to read any files.' );\n* }\n* }\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* anyByRightAsync( files, predicate, done );\n*/\nfunction anyByRightAsync( collection, options, predicate, done ) {\n\tif ( arguments.length < 4 ) {\n\t\treturn factory( options )( collection, predicate );\n\t}\n\tfactory( options, predicate )( collection, done );\n}\n\n\n// EXPORTS //\n\nexport default anyByRightAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* 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* 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/**\n* Test whether at least one element in a collection passes a test implemented by a predicate function, iterating from right to left.\n*\n* @module @stdlib/utils-async-any-by-right\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n* import anyByRightAsync from '@stdlib/utils-async-any-by-right';\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* function done( error, bool ) {\n* if ( error ) {\n* throw error;\n* }\n* if ( bool ) {\n* console.log( 'Successfully read at least one file.' );\n* } else {\n* console.log( 'Unable to read any files.' );\n* }\n* }\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* anyByRightAsync( files, predicate, done );\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\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// 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// 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/**\n* Test if a value is a string.\n*\n* @module @stdlib/assert-is-string\n*\n* @example\n* import isString from '@stdlib/assert-is-string';\n*\n* var bool = isString( 'beep' );\n* // returns true\n*\n* bool = isString( new String( 'beep' ) );\n* // returns true\n*\n* bool = isString( 5 );\n* // returns false\n*\n* @example\n* import { isObject as isString } from '@stdlib/assert-is-string';\n*\n* var bool = isString( new String( 'beep' ) );\n* // returns true\n*\n* bool = isString( 'beep' );\n* // returns false\n*\n* @example\n* import { isPrimitive as isString } from '@stdlib/assert-is-string';\n*\n* var bool = isString( 'beep' );\n* // returns true\n*\n* bool = isString( new String( 'beep' ) );\n* // returns false\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport isPrimitive from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'isPrimitive', isPrimitive );\nsetReadOnly( main, 'isObject', isObject );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport 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 isPositiveInteger } from '@stdlib/assert-is-positive-integer';\nimport indexOf from '@stdlib/utils-index-of';\nimport format from '@stdlib/string-format';\n\n\n// VARIABLES //\n\nvar returns = [ 'values', 'indices', '*' ];\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 {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {string} [options.returns] - output format\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'thisArg': {},\n* 'series': false,\n* 'limit': 10,\n* 'returns': '*'\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, 'thisArg' ) ) {\n\t\topts.thisArg = options.thisArg;\n\t}\n\tif ( hasOwnProp( options, 'series' ) ) {\n\t\topts.series = options.series;\n\t\tif ( !isBoolean( opts.series ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'series', opts.series ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'limit' ) ) {\n\t\topts.limit = options.limit;\n\t\tif ( !isPositiveInteger( opts.limit ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'returns' ) ) {\n\t\topts.returns = options.returns;\n\t\tif ( indexOf( returns, opts.returns ) === -1 ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be one of the following: \"%s\". Option: `%s`.', 'returns', returns.join( '\", \"' ), opts.returns ) );\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' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'bifurcate-by-async:limit' );\n\n\n// MAIN //\n\n/**\n* Invokes a predicate function once for each element in a collection, limiting the number of concurrently pending functions.\n*\n* ## Notes\n*\n* - We need to cache the collection value to prevent the edge case where, during the invocation of the predicate function, the element at index `i` is swapped for some other value. For some, that might be a feature; here, we take the stance that one should be less clever.\n*\n* @private\n* @param {Collection} collection - input collection\n* @param {Options} opts - function options\n* @param {*} [opts.thisArg] - execution context\n* @param {PositiveInteger} [opts.limit] - maximum number of pending function invocations\n* @param {string} [options.returns] - output format\n* @param {Function} predicate - predicate function\n* @param {Callback} done - function to invoke upon completion or upon encountering an error\n* @returns {void}\n*/\nfunction limit( collection, opts, predicate, done ) {\n\tvar maxIndex;\n\tvar count;\n\tvar flg;\n\tvar lim;\n\tvar len;\n\tvar idx;\n\tvar out;\n\tvar i;\n\n\tlen = collection.length;\n\tdebug( 'Collection length: %d', len );\n\n\tout = [];\n\tif ( len === 0 ) {\n\t\tdebug( 'Finished processing a collection.' );\n\t\treturn done( null, out );\n\t}\n\tout.push( [], [] );\n\tif ( len < opts.limit ) {\n\t\tlim = len;\n\t} else {\n\t\tlim = opts.limit;\n\t}\n\tdebug( 'Concurrency limit: %d', lim );\n\tdebug( 'Number of arguments: %d', predicate.length );\n\n\tmaxIndex = len - 1;\n\tcount = 0;\n\tidx = -1;\n\tfor ( i = 0; i < lim; i++ ) {\n\t\t// This guard is necessary to protect against synchronous functions which exhaust all collection elements...\n\t\tif ( idx < maxIndex ) {\n\t\t\tnext(); // eslint-disable-line node/callback-return\n\t\t}\n\t}\n\t/**\n\t* Callback to invoke a provided function for the next element in a collection.\n\t*\n\t* @private\n\t*/\n\tfunction next() {\n\t\tvar v;\n\t\tvar j;\n\n\t\tidx += 1;\n\t\tj = idx;\n\t\tv = collection[ j ];\n\n\t\tdebug( 'Collection element %d: %s.', j, JSON.stringify( v ) );\n\t\tif ( predicate.length === 2 ) {\n\t\t\tpredicate.call( opts.thisArg, v, cb );\n\t\t} else if ( predicate.length === 3 ) {\n\t\t\tpredicate.call( opts.thisArg, v, j, cb );\n\t\t} else {\n\t\t\tpredicate.call( opts.thisArg, v, j, collection, cb );\n\t\t}\n\t\t/**\n\t\t* Callback invoked once a provided function finishes processing a collection element.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {*} [bool] - group indicator\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction cb( error, bool ) {\n\t\t\tif ( flg ) {\n\t\t\t\t// Prevent further processing of collection elements:\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( error ) {\n\t\t\t\tflg = true;\n\t\t\t\treturn clbk( error );\n\t\t\t}\n\t\t\tdebug( 'Collection element %d group: %s.', j, ( bool ) ? '0' : '1' );\n\n\t\t\t// Default is to return values...\n\t\t\tif ( opts.returns === 'indices' ) {\n\t\t\t\tif ( bool ) {\n\t\t\t\t\tout[ 0 ].push( j );\n\t\t\t\t} else {\n\t\t\t\t\tout[ 1 ].push( j );\n\t\t\t\t}\n\t\t\t} else if ( opts.returns === '*' ) {\n\t\t\t\tif ( bool ) {\n\t\t\t\t\tout[ 0 ].push( [ j, v ] );\n\t\t\t\t} else {\n\t\t\t\t\tout[ 1 ].push( [ j, v ] );\n\t\t\t\t}\n\t\t\t} else if ( bool ) {\n\t\t\t\tout[ 0 ].push( v );\n\t\t\t} else {\n\t\t\t\tout[ 1 ].push( v );\n\t\t\t}\n\t\t\tclbk();\n\t\t}\n\t}\n\n\t/**\n\t* Callback invoked once ready to process the next collection element.\n\t*\n\t* @private\n\t* @param {*} [error] - error\n\t* @returns {void}\n\t*/\n\tfunction clbk( error ) {\n\t\tif ( error ) {\n\t\t\tdebug( 'Encountered an error: %s', error.message );\n\t\t\treturn done( error );\n\t\t}\n\t\tcount += 1;\n\t\tdebug( 'Processed %d of %d collection elements.', count, len );\n\t\tif ( idx < maxIndex ) {\n\t\t\treturn next();\n\t\t}\n\t\tif ( count === len ) {\n\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\treturn done( null, out );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default limit;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isCollection from '@stdlib/assert-is-collection';\nimport format from '@stdlib/string-format';\nimport PINF from '@stdlib/constants-float64-pinf';\nimport validate from './validate.js';\nimport limit from './limit.js';\n\n\n// MAIN //\n\n/**\n* Returns a function which splits values into two groups according to a predicate function.\n*\n* ## Notes\n*\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {string} [options.returns=\"values\"] - if `values`, values are returned; if `indices`, indices are returned; if `*`, both indices and values are returned\n* @param {Function} predicate - predicate function specifying which group an element in the input collection belongs to\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} last argument must be a function\n* @returns {Function} function which invokes the predicate function once for each element in a collection\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* var opts = {\n* 'series': true\n* };\n*\n* // Create a `bifurcateByAsync` function which invokes the predicate function for each collection element sequentially:\n* var bifurcateByAsync = factory( opts, predicate );\n*\n* // Create a collection over which to iterate:\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* // Define a callback which handles results:\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* }\n*\n* // Try to read each element in `files`:\n* bifurcateByAsync( files, done );\n*/\nfunction factory( options, predicate ) {\n\tvar opts;\n\tvar err;\n\tvar f;\n\n\topts = {};\n\tif ( arguments.length > 1 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t\tf = predicate;\n\t} else {\n\t\tf = options;\n\t}\n\tif ( !isFunction( f ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', f ) );\n\t}\n\tif ( opts.series ) {\n\t\topts.limit = 1;\n\t} else if ( !opts.limit ) {\n\t\topts.limit = PINF;\n\t}\n\treturn bifurcateByAsync;\n\n\t/**\n\t* Invokes a predicate function for each element in a collection.\n\t*\n\t* @private\n\t* @param {Collection} collection - input collection\n\t* @param {Callback} done - function to invoke upon completion\n\t* @throws {TypeError} first argument must be a collection\n\t* @throws {TypeError} last argument must be a function\n\t* @returns {void}\n\t*/\n\tfunction bifurcateByAsync( collection, done ) {\n\t\tif ( !isCollection( collection ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a collection. Value: `%s`.', collection ) );\n\t\t}\n\t\tif ( !isFunction( done ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t\t}\n\t\treturn limit( collection, opts, f, clbk );\n\n\t\t/**\n\t\t* Callback invoked upon completion.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {Object} results - bifurcation results\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction clbk( error, results ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\tdone( null, results );\n\t\t}\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 factory from './factory.js';\n\n\n// MAIN //\n\n/**\n* Splits values into two groups according to a predicate function.\n*\n* ## Notes\n*\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Collection} collection - input collection\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {string} [options.returns=\"values\"] - if `values`, values are returned; if `indices`, indices are returned; if `*`, both indices and values are returned\n* @param {Function} predicate - predicate function specifying which group an element in the input collection belongs to\n* @param {Callback} done - function to invoke upon completion\n* @throws {TypeError} first argument must be a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} second-to-last argument must be a function\n* @throws {TypeError} last argument must be a function\n* @returns {void}\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* }\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* bifurcateByAsync( files, predicate, done );\n*/\nfunction bifurcateByAsync( collection, options, predicate, done ) {\n\tif ( arguments.length < 4 ) {\n\t\treturn factory( options )( collection, predicate );\n\t}\n\tfactory( options, predicate )( collection, done );\n}\n\n\n// EXPORTS //\n\nexport default bifurcateByAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Split values into two groups according to a predicate function.\n*\n* @module @stdlib/utils-async-bifurcate-by\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n* import bifurcateByAsync from '@stdlib/utils-async-bifurcate-by';\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* }\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* bifurcateByAsync( files, predicate, done );\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport hasOwnProp from '@stdlib/assert-has-own-property';\n\n\n// VARIABLES //\n\nvar debug = logger( 'count-by-async:limit' );\n\n\n// MAIN //\n\n/**\n* Invokes an indicator function once for each element in a collection, limiting the number of concurrently pending functions.\n*\n* @private\n* @param {Collection} collection - input collection\n* @param {Options} opts - function options\n* @param {*} [opts.thisArg] - execution context\n* @param {PositiveInteger} [opts.limit] - maximum number of pending function invocations\n* @param {Function} indicator - indicator function\n* @param {Callback} done - function to invoke upon completion or upon encountering an error\n* @returns {void}\n*/\nfunction limit( collection, opts, indicator, done ) {\n\tvar maxIndex;\n\tvar count;\n\tvar flg;\n\tvar lim;\n\tvar len;\n\tvar idx;\n\tvar out;\n\tvar i;\n\n\tlen = collection.length;\n\tdebug( 'Collection length: %d', len );\n\n\tout = {};\n\tif ( len === 0 ) {\n\t\tdebug( 'Finished processing a collection.' );\n\t\treturn done( null, out );\n\t}\n\tif ( len < opts.limit ) {\n\t\tlim = len;\n\t} else {\n\t\tlim = opts.limit;\n\t}\n\tdebug( 'Concurrency limit: %d', lim );\n\tdebug( 'Number of arguments: %d', indicator.length );\n\n\tmaxIndex = len - 1;\n\tcount = 0;\n\tidx = -1;\n\tfor ( i = 0; i < lim; i++ ) {\n\t\t// This guard is necessary to protect against synchronous functions which exhaust all collection elements...\n\t\tif ( idx < maxIndex ) {\n\t\t\tnext(); // eslint-disable-line node/callback-return\n\t\t}\n\t}\n\t/**\n\t* Callback to invoke a provided function for the next element in a collection.\n\t*\n\t* @private\n\t*/\n\tfunction next() {\n\t\tvar v;\n\t\tvar j;\n\n\t\tidx += 1;\n\t\tj = idx;\n\t\tv = collection[ j ];\n\n\t\tdebug( 'Collection element %d: %s.', j, JSON.stringify( v ) );\n\t\tif ( indicator.length === 2 ) {\n\t\t\tindicator.call( opts.thisArg, v, cb );\n\t\t} else if ( indicator.length === 3 ) {\n\t\t\tindicator.call( opts.thisArg, v, j, cb );\n\t\t} else {\n\t\t\tindicator.call( opts.thisArg, v, j, collection, cb );\n\t\t}\n\t\t/**\n\t\t* Callback invoked once a provided function finishes processing a collection element.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {*} [group] - group\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction cb( error, group ) {\n\t\t\tif ( flg ) {\n\t\t\t\t// Prevent further processing of collection elements:\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( error ) {\n\t\t\t\tflg = true;\n\t\t\t\treturn clbk( error );\n\t\t\t}\n\t\t\tdebug( 'Collection element %d group: %s.', j, group );\n\n\t\t\t// Checking for an \"own\" property is necessary to guard against the edge case where an indicator function returns a group identifier which matches a method or property on the `Object` prototype.\n\t\t\tif ( hasOwnProp( out, group ) ) {\n\t\t\t\tout[ group ] += 1;\n\t\t\t} else {\n\t\t\t\tout[ group ] = 1;\n\t\t\t}\n\t\t\tclbk();\n\t\t}\n\t}\n\n\t/**\n\t* Callback invoked once ready to process the next collection element.\n\t*\n\t* @private\n\t* @param {*} [error] - error\n\t* @returns {void}\n\t*/\n\tfunction clbk( error ) {\n\t\tif ( error ) {\n\t\t\tdebug( 'Encountered an error: %s', error.message );\n\t\t\treturn done( error );\n\t\t}\n\t\tcount += 1;\n\t\tdebug( 'Processed %d of %d collection elements.', count, len );\n\t\tif ( idx < maxIndex ) {\n\t\t\treturn next();\n\t\t}\n\t\tif ( count === len ) {\n\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\treturn done( null, out );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default limit;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isCollection from '@stdlib/assert-is-collection';\nimport format from '@stdlib/string-format';\nimport PINF from '@stdlib/constants-float64-pinf';\nimport validate from './validate.js';\nimport limit from './limit.js';\n\n\n// MAIN //\n\n/**\n* Returns a function for grouping values according to an indicator function and returns group counts.\n*\n* ## Notes\n*\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} indicator - indicator function specifying which group an element in the input collection belongs to\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} last argument must be a function\n* @returns {Function} function which invokes the indicator function once for each element in a collection\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function indicator( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, 'nonreadable' );\n* }\n* next( null, 'readable' );\n* }\n* }\n*\n* var opts = {\n* 'series': true\n* };\n*\n* // Create a `countByAsync` function which invokes the indicator function for each collection element sequentially:\n* var countByAsync = factory( opts, indicator );\n*\n* // Create a collection over which to iterate:\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* // Define a callback which handles results:\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* }\n*\n* // Try to read each element in `files`:\n* countByAsync( files, done );\n*/\nfunction factory( options, indicator ) {\n\tvar opts;\n\tvar err;\n\tvar f;\n\n\topts = {};\n\tif ( arguments.length > 1 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t\tf = indicator;\n\t} else {\n\t\tf = options;\n\t}\n\tif ( !isFunction( f ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', f ) );\n\t}\n\tif ( opts.series ) {\n\t\topts.limit = 1;\n\t} else if ( !opts.limit ) {\n\t\topts.limit = PINF;\n\t}\n\treturn countByAsync;\n\n\t/**\n\t* Invokes an indicator function for each element in a collection.\n\t*\n\t* @private\n\t* @param {Collection} collection - input collection\n\t* @param {Callback} done - function to invoke upon completion\n\t* @throws {TypeError} first argument must be a collection\n\t* @throws {TypeError} last argument must be a function\n\t* @returns {void}\n\t*/\n\tfunction countByAsync( collection, done ) {\n\t\tif ( !isCollection( collection ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a collection. Value: `%s`.', collection ) );\n\t\t}\n\t\tif ( !isFunction( done ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t\t}\n\t\treturn limit( collection, opts, f, clbk );\n\n\t\t/**\n\t\t* Callback invoked upon completion.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {Object} result - counts\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction clbk( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\tdone( null, result );\n\t\t}\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 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 isPositiveInteger } from '@stdlib/assert-is-positive-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 {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'thisArg': {},\n* 'series': false,\n* 'limit': 10\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, 'thisArg' ) ) {\n\t\topts.thisArg = options.thisArg;\n\t}\n\tif ( hasOwnProp( options, 'series' ) ) {\n\t\topts.series = options.series;\n\t\tif ( !isBoolean( opts.series ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'series', opts.series ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'limit' ) ) {\n\t\topts.limit = options.limit;\n\t\tif ( !isPositiveInteger( opts.limit ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport factory from './factory.js';\n\n\n// MAIN //\n\n/**\n* Groups values according to an indicator function and returns group counts.\n*\n* ## Notes\n*\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Collection} collection - input collection\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} indicator - indicator function specifying which group an element in the input collection belongs to\n* @param {Callback} done - function to invoke upon completion\n* @throws {TypeError} first argument must be a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} second-to-last argument must be a function\n* @throws {TypeError} last argument must be a function\n* @returns {void}\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* }\n*\n* function indicator( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, 'nonreadable' );\n* }\n* next( null, 'readable' );\n* }\n* }\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* countByAsync( files, indicator, done );\n*/\nfunction countByAsync( collection, options, indicator, done ) {\n\tif ( arguments.length < 4 ) {\n\t\treturn factory( options )( collection, indicator );\n\t}\n\tfactory( options, indicator )( collection, done );\n}\n\n\n// EXPORTS //\n\nexport default countByAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Group values according to an indicator function and return group counts.\n*\n* @module @stdlib/utils-async-count-by\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n* import countByAsync from '@stdlib/utils-async-count-by';\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* }\n*\n* function indicator( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, 'nonreadable' );\n* }\n* next( null, 'readable' );\n* }\n* }\n*\n* countByAsync( files, indicator, done );\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'every-by-async:limit' );\n\n\n// MAIN //\n\n/**\n* Invokes a predicate function once for each element in a collection, limiting the number of concurrently pending functions.\n*\n* @private\n* @param {Collection} collection - input collection\n* @param {Options} opts - function options\n* @param {*} [opts.thisArg] - execution context\n* @param {PositiveInteger} [opts.limit] - maximum number of pending function invocations\n* @param {Function} predicate - predicate function\n* @param {Callback} done - function to invoke upon completion or upon encountering an error\n* @returns {void}\n*/\nfunction limit( collection, opts, predicate, done ) {\n\tvar maxIndex;\n\tvar count;\n\tvar flg;\n\tvar lim;\n\tvar len;\n\tvar idx;\n\tvar i;\n\n\tlen = collection.length;\n\tdebug( 'Collection length: %d', len );\n\n\tif ( len === 0 ) {\n\t\tdebug( 'Finished processing a collection.' );\n\t\treturn done( null, true );\n\t}\n\tif ( len < opts.limit ) {\n\t\tlim = len;\n\t} else {\n\t\tlim = opts.limit;\n\t}\n\tdebug( 'Concurrency limit: %d', lim );\n\tdebug( 'Number of arguments: %d', predicate.length );\n\n\tmaxIndex = len - 1;\n\tcount = 0;\n\tidx = -1;\n\tfor ( i = 0; i < lim; i++ ) {\n\t\t// This guard is necessary to protect against synchronous functions which exhaust all collection elements...\n\t\tif ( idx < maxIndex ) {\n\t\t\tnext(); // eslint-disable-line node/callback-return\n\t\t}\n\t}\n\n\t/**\n\t* Callback to invoke a provided function for the next element in a collection.\n\t*\n\t* @private\n\t*/\n\tfunction next() {\n\t\tidx += 1;\n\t\tdebug( 'Collection element %d: %s.', idx, JSON.stringify( collection[ idx ] ) );\n\t\tif ( predicate.length === 2 ) {\n\t\t\tpredicate.call( opts.thisArg, collection[ idx ], clbk );\n\t\t} else if ( predicate.length === 3 ) {\n\t\t\tpredicate.call( opts.thisArg, collection[ idx ], idx, clbk );\n\t\t} else {\n\t\t\tpredicate.call( opts.thisArg, collection[ idx ], idx, collection, clbk ); // eslint-disable-line max-len\n\t\t}\n\t}\n\n\t/**\n\t* Callback invoked once a provided function finishes processing a collection element.\n\t*\n\t* @private\n\t* @param {*} [error] - error\n\t* @param {*} [result] - test result\n\t* @returns {void}\n\t*/\n\tfunction clbk( error, result ) {\n\t\tif ( flg ) {\n\t\t\t// Prevent further processing of collection elements:\n\t\t\treturn;\n\t\t}\n\t\tif ( error ) {\n\t\t\tflg = true;\n\t\t\tdebug( 'Encountered an error: %s', error.message );\n\t\t\treturn done( error );\n\t\t}\n\t\tcount += 1;\n\t\tdebug( 'Processed %d of %d collection elements.', count, len );\n\n\t\tdebug( 'Test result: %s', !!result );\n\t\tif ( !result && !flg ) {\n\t\t\tflg = true;\n\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\treturn done( null, false );\n\t\t}\n\t\tif ( idx < maxIndex ) {\n\t\t\treturn next();\n\t\t}\n\t\tif ( count === len ) {\n\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\treturn done( null, true );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default limit;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isCollection from '@stdlib/assert-is-collection';\nimport PINF from '@stdlib/constants-float64-pinf';\nimport format from '@stdlib/string-format';\nimport validate from './validate.js';\nimport limit from './limit.js';\n\n\n// MAIN //\n\n/**\n* Returns a function for testing whether all elements in a collection pass a test implemented by a predicate function.\n*\n* ## Notes\n*\n* - If a predicate function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} predicate - predicate function to invoke for each element in a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} last argument must be a function\n* @returns {Function} function which invokes the predicate function once for each element in a collection\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* var opts = {\n* 'series': true\n* };\n*\n* // Create an `everyByAsync` function which invokes the predicate function for each collection element sequentially:\n* var everyByAsync = factory( opts, predicate );\n*\n* // Create a collection over which to iterate:\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* // Define a callback which handles results:\n* function done( error, bool ) {\n* if ( error ) {\n* throw error;\n* }\n* if ( bool ) {\n* console.log( 'Successfully read all files.' );\n* } else {\n* console.log( 'Was unable to read all files.' );\n* }\n* }\n*\n* // Try to read each element in `files`:\n* everyByAsync( files, done );\n*/\nfunction factory( options, predicate ) {\n\tvar opts;\n\tvar err;\n\tvar f;\n\n\topts = {};\n\tif ( arguments.length > 1 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t\tf = predicate;\n\t} else {\n\t\tf = options;\n\t}\n\tif ( !isFunction( f ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', f ) );\n\t}\n\tif ( opts.series ) {\n\t\topts.limit = 1;\n\t} else if ( !opts.limit ) {\n\t\topts.limit = PINF;\n\t}\n\treturn everyByAsync;\n\n\t/**\n\t* Invokes a predicate function for each element in a collection.\n\t*\n\t* @private\n\t* @param {Collection} collection - input collection\n\t* @param {Callback} done - function to invoke upon completion\n\t* @throws {TypeError} first argument must be a collection\n\t* @throws {TypeError} last argument must be a function\n\t* @returns {void}\n\t*/\n\tfunction everyByAsync( collection, done ) {\n\t\tif ( !isCollection( collection ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a collection. Value: `%s`.', collection ) );\n\t\t}\n\t\tif ( !isFunction( done ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t\t}\n\t\treturn limit( collection, opts, f, clbk );\n\n\t\t/**\n\t\t* Callback invoked upon completion.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {boolean} bool - test result\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction clbk( error, bool ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error, false );\n\t\t\t}\n\t\t\tdone( null, bool );\n\t\t}\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 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 isPositiveInteger } from '@stdlib/assert-is-positive-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 {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'thisArg': {},\n* 'series': false,\n* 'limit': 10\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, 'thisArg' ) ) {\n\t\topts.thisArg = options.thisArg;\n\t}\n\tif ( hasOwnProp( options, 'series' ) ) {\n\t\topts.series = options.series;\n\t\tif ( !isBoolean( opts.series ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'series', opts.series ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'limit' ) ) {\n\t\topts.limit = options.limit;\n\t\tif ( !isPositiveInteger( opts.limit ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport factory from './factory.js';\n\n\n// MAIN //\n\n/**\n* Tests whether all elements in a collection pass a test implemented by a predicate function.\n*\n* ## Notes\n*\n* - If a predicate function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Collection} collection - input collection\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} predicate - predicate function to invoke for each element in a collection\n* @param {Callback} done - function to invoke upon completion\n* @throws {TypeError} first argument must be a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} second-to-last argument must be a function\n* @throws {TypeError} last argument must be a function\n* @returns {void}\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function done( error, bool ) {\n* if ( error ) {\n* throw error;\n* }\n* if ( bool ) {\n* console.log( 'Successfully read all files.' );\n* } else {\n* console.log( 'Was unable to read all files.' );\n* }\n* }\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* everyByAsync( files, predicate, done );\n*/\nfunction everyByAsync( collection, options, predicate, done ) {\n\tif ( arguments.length < 4 ) {\n\t\treturn factory( options )( collection, predicate );\n\t}\n\tfactory( options, predicate )( collection, done );\n}\n\n\n// EXPORTS //\n\nexport default everyByAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\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 whether all elements in a collection pass a test implemented by a predicate function.\n*\n* @module @stdlib/utils-async-every-by\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n* import everyByAsync from '@stdlib/utils-async-every-by';\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* function done( error, bool ) {\n* if ( error ) {\n* throw error;\n* }\n* if ( bool ) {\n* console.log( 'Successfully read all files.' );\n* } else {\n* console.log( 'Was unable to read all files.' );\n* }\n* }\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* everyByAsync( files, predicate, done );\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'every-by-right-async:limit' );\n\n\n// MAIN //\n\n/**\n* Invokes a predicate function once for each element in a collection, limiting the number of concurrently pending functions, and iterating from right to left.\n*\n* @private\n* @param {Collection} collection - input collection\n* @param {Options} opts - function options\n* @param {*} [opts.thisArg] - execution context\n* @param {PositiveInteger} [opts.limit] - maximum number of pending function invocations\n* @param {Function} predicate - predicate function\n* @param {Callback} done - function to invoke upon completion or upon encountering an error\n* @returns {void}\n*/\nfunction limit( collection, opts, predicate, done ) {\n\tvar count;\n\tvar flg;\n\tvar lim;\n\tvar len;\n\tvar idx;\n\tvar i;\n\n\tlen = collection.length;\n\tdebug( 'Collection length: %d', len );\n\n\tif ( len === 0 ) {\n\t\tdebug( 'Finished processing a collection.' );\n\t\treturn done( null, true );\n\t}\n\tif ( len < opts.limit ) {\n\t\tlim = len;\n\t} else {\n\t\tlim = opts.limit;\n\t}\n\tdebug( 'Concurrency limit: %d', lim );\n\tdebug( 'Number of arguments: %d', predicate.length );\n\n\tcount = 0;\n\tidx = len;\n\tfor ( i = 0; i < lim; i++ ) {\n\t\t// This guard is necessary to protect against synchronous functions which exhaust all collection elements...\n\t\tif ( idx > 0 ) {\n\t\t\tnext(); // eslint-disable-line node/callback-return\n\t\t}\n\t}\n\n\t/**\n\t* Callback to invoke a provided function for the next element in a collection.\n\t*\n\t* @private\n\t*/\n\tfunction next() {\n\t\tidx -= 1;\n\t\tdebug( 'Collection element %d: %s.', idx, JSON.stringify( collection[ idx ] ) );\n\t\tif ( predicate.length === 2 ) {\n\t\t\tpredicate.call( opts.thisArg, collection[ idx ], clbk );\n\t\t} else if ( predicate.length === 3 ) {\n\t\t\tpredicate.call( opts.thisArg, collection[ idx ], idx, clbk );\n\t\t} else {\n\t\t\tpredicate.call( opts.thisArg, collection[ idx ], idx, collection, clbk ); // eslint-disable-line max-len\n\t\t}\n\t}\n\n\t/**\n\t* Callback invoked once a provided function finishes processing a collection element.\n\t*\n\t* @private\n\t* @param {*} [error] - error\n\t* @param {*} [result] - test result\n\t* @returns {void}\n\t*/\n\tfunction clbk( error, result ) {\n\t\tif ( flg ) {\n\t\t\t// Prevent further processing of collection elements:\n\t\t\treturn;\n\t\t}\n\t\tif ( error ) {\n\t\t\tflg = true;\n\t\t\tdebug( 'Encountered an error: %s', error.message );\n\t\t\treturn done( error );\n\t\t}\n\t\tcount += 1;\n\t\tdebug( 'Processed %d of %d collection elements.', count, len );\n\n\t\tdebug( 'Test result: %s', !!result );\n\t\tif ( !result && !flg ) {\n\t\t\tflg = true;\n\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\treturn done( null, false );\n\t\t}\n\t\tif ( idx > 0 ) {\n\t\t\treturn next();\n\t\t}\n\t\tif ( count === len ) {\n\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\treturn done( null, true );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default limit;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isCollection from '@stdlib/assert-is-collection';\nimport PINF from '@stdlib/constants-float64-pinf';\nimport format from '@stdlib/string-format';\nimport validate from './validate.js';\nimport limit from './limit.js';\n\n\n// MAIN //\n\n/**\n* Returns a function for testing whether all elements in a collection pass a test implemented by a predicate function, iterating from right to left.\n*\n* ## Notes\n*\n* - If a predicate function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} predicate - predicate function to invoke for each element in a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} last argument must be a function\n* @returns {Function} function which invokes the predicate function once for each element in a collection\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* var opts = {\n* 'series': true\n* };\n*\n* // Create an `everyByRightAsync` function which invokes the predicate function for each collection element sequentially:\n* var everyByRightAsync = factory( opts, predicate );\n*\n* // Create a collection over which to iterate:\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* // Define a callback which handles results:\n* function done( error, bool ) {\n* if ( error ) {\n* throw error;\n* }\n* if ( bool ) {\n* console.log( 'Successfully read all files.' );\n* } else {\n* console.log( 'Was unable to read all files.' );\n* }\n* }\n*\n* // Try to read each element in `files`:\n* everyByRightAsync( files, done );\n*/\nfunction factory( options, predicate ) {\n\tvar opts;\n\tvar err;\n\tvar f;\n\n\topts = {};\n\tif ( arguments.length > 1 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t\tf = predicate;\n\t} else {\n\t\tf = options;\n\t}\n\tif ( !isFunction( f ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', f ) );\n\t}\n\tif ( opts.series ) {\n\t\topts.limit = 1;\n\t} else if ( !opts.limit ) {\n\t\topts.limit = PINF;\n\t}\n\treturn everyByRightAsync;\n\n\t/**\n\t* Invokes a predicate function for each element in a collection, iterating from right to left.\n\t*\n\t* @private\n\t* @param {Collection} collection - input collection\n\t* @param {Callback} done - function to invoke upon completion\n\t* @throws {TypeError} first argument must be a collection\n\t* @throws {TypeError} last argument must be a function\n\t* @returns {void}\n\t*/\n\tfunction everyByRightAsync( collection, done ) {\n\t\tif ( !isCollection( collection ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a collection. Value: `%s`.', collection ) );\n\t\t}\n\t\tif ( !isFunction( done ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t\t}\n\t\treturn limit( collection, opts, f, clbk );\n\n\t\t/**\n\t\t* Callback invoked upon completion.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {boolean} bool - test result\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction clbk( error, bool ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error, false );\n\t\t\t}\n\t\t\tdone( null, bool );\n\t\t}\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 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 isPositiveInteger } from '@stdlib/assert-is-positive-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 {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'thisArg': {},\n* 'series': false,\n* 'limit': 10\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, 'thisArg' ) ) {\n\t\topts.thisArg = options.thisArg;\n\t}\n\tif ( hasOwnProp( options, 'series' ) ) {\n\t\topts.series = options.series;\n\t\tif ( !isBoolean( opts.series ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'series', opts.series ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'limit' ) ) {\n\t\topts.limit = options.limit;\n\t\tif ( !isPositiveInteger( opts.limit ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport factory from './factory.js';\n\n\n// MAIN //\n\n/**\n* Tests whether all elements in a collection pass a test implemented by a predicate function, iterating from right to left.\n*\n* ## Notes\n*\n* - If a predicate function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Collection} collection - input collection\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} predicate - predicate function to invoke for each element in a collection\n* @param {Callback} done - function to invoke upon completion\n* @throws {TypeError} first argument must be a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} second-to-last argument must be a function\n* @throws {TypeError} last argument must be a function\n* @returns {void}\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function done( error, bool ) {\n* if ( error ) {\n* throw error;\n* }\n* if ( bool ) {\n* console.log( 'Successfully read all files.' );\n* } else {\n* console.log( 'Was unable to read all files.' );\n* }\n* }\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* everyByRightAsync( files, predicate, done );\n*/\nfunction everyByRightAsync( collection, options, predicate, done ) {\n\tif ( arguments.length < 4 ) {\n\t\treturn factory( options )( collection, predicate );\n\t}\n\tfactory( options, predicate )( collection, done );\n}\n\n\n// EXPORTS //\n\nexport default everyByRightAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\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 whether all elements in a collection pass a test implemented by a predicate function, iterating from right to left.\n*\n* @module @stdlib/utils-async-every-by-right\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n* import everyByRightAsync from '@stdlib/utils-async-every-by-right';\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* function done( error, bool ) {\n* if ( error ) {\n* throw error;\n* }\n* if ( bool ) {\n* console.log( 'Successfully read all files.' );\n* } else {\n* console.log( 'Was unable to read all files.' );\n* }\n* }\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* everyByRightAsync( files, predicate, done );\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'for-each-async:limit' );\n\n\n// MAIN //\n\n/**\n* Invokes a function once for each element in a collection, limiting the number of concurrently pending functions.\n*\n* @private\n* @param {Collection} collection - input collection\n* @param {Options} opts - function options\n* @param {*} [opts.thisArg] - execution context\n* @param {PositiveInteger} [opts.limit] - maximum number of pending function invocations\n* @param {Function} fcn - function to invoke\n* @param {Callback} done - function to invoke upon completion or upon encountering an error\n* @returns {void}\n*/\nfunction limit( collection, opts, fcn, done ) {\n\tvar maxIndex;\n\tvar count;\n\tvar flg;\n\tvar lim;\n\tvar len;\n\tvar idx;\n\tvar i;\n\n\tlen = collection.length;\n\tdebug( 'Collection length: %d', len );\n\n\tif ( len === 0 ) {\n\t\tdebug( 'Finished processing a collection.' );\n\t\treturn done();\n\t}\n\tif ( len < opts.limit ) {\n\t\tlim = len;\n\t} else {\n\t\tlim = opts.limit;\n\t}\n\tdebug( 'Concurrency limit: %d', lim );\n\tdebug( 'Number of arguments: %d', fcn.length );\n\n\tmaxIndex = len - 1;\n\tcount = 0;\n\tidx = -1;\n\tfor ( i = 0; i < lim; i++ ) {\n\t\t// This guard is necessary to protect against synchronous functions which exhaust all collection elements...\n\t\tif ( idx < maxIndex ) {\n\t\t\tnext(); // eslint-disable-line node/callback-return\n\t\t}\n\t}\n\n\t/**\n\t* Callback to invoke a provided function for the next element in a collection.\n\t*\n\t* @private\n\t*/\n\tfunction next() {\n\t\tidx += 1;\n\t\tdebug( 'Collection element %d: %s.', idx, JSON.stringify( collection[ idx ] ) );\n\t\tif ( fcn.length === 2 ) {\n\t\t\tfcn.call( opts.thisArg, collection[ idx ], clbk );\n\t\t} else if ( fcn.length === 3 ) {\n\t\t\tfcn.call( opts.thisArg, collection[ idx ], idx, clbk );\n\t\t} else {\n\t\t\tfcn.call( opts.thisArg, collection[ idx ], idx, collection, clbk );\n\t\t}\n\t}\n\n\t/**\n\t* Callback invoked once a provided function finishes processing a collection element.\n\t*\n\t* @private\n\t* @param {*} [error] - error\n\t* @returns {void}\n\t*/\n\tfunction clbk( error ) {\n\t\tif ( flg ) {\n\t\t\t// Prevent further processing of collection elements:\n\t\t\treturn;\n\t\t}\n\t\tif ( error ) {\n\t\t\tflg = true;\n\t\t\tdebug( 'Encountered an error: %s', error.message );\n\t\t\treturn done( error );\n\t\t}\n\t\tcount += 1;\n\t\tdebug( 'Processed %d of %d collection elements.', count, len );\n\t\tif ( idx < maxIndex ) {\n\t\t\treturn next();\n\t\t}\n\t\tif ( count === len ) {\n\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\treturn done();\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default limit;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isCollection from '@stdlib/assert-is-collection';\nimport format from '@stdlib/string-format';\nimport PINF from '@stdlib/constants-float64-pinf';\nimport validate from './validate.js';\nimport limit from './limit.js';\n\n\n// MAIN //\n\n/**\n* Returns a function to invoke a function once for each element in a collection.\n*\n* ## Notes\n*\n* - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} fcn - function to invoke for each element in a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} last argument must be a function\n* @returns {Function} function which invokes the provided function once for each element in a collection\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function read( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( error );\n* }\n* console.log( 'Successfully read file: %s', file );\n* next();\n* }\n* }\n*\n* var opts = {\n* 'series': true\n* };\n*\n* // Create a `forEachAsync` function which invokes `read` for each collection element sequentially:\n* var forEachAsync = factory( opts, read );\n*\n* // Create a collection over which to iterate:\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* // Define a callback which handles errors:\n* function done( error ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( 'Successfully read all files.' );\n* }\n*\n* // Run `read` for each element in `files`:\n* forEachAsync( files, done );\n*/\nfunction factory( options, fcn ) {\n\tvar opts;\n\tvar err;\n\tvar f;\n\n\topts = {};\n\tif ( arguments.length > 1 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t\tf = fcn;\n\t} else {\n\t\tf = options;\n\t}\n\tif ( !isFunction( f ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', f ) );\n\t}\n\tif ( opts.series ) {\n\t\topts.limit = 1;\n\t} else if ( !opts.limit ) {\n\t\topts.limit = PINF;\n\t}\n\treturn forEachAsync;\n\n\t/**\n\t* Invokes a function for each element in a collection.\n\t*\n\t* @private\n\t* @param {Collection} collection - input collection\n\t* @param {Callback} done - function to invoke upon completion\n\t* @throws {TypeError} first argument must be a collection\n\t* @throws {TypeError} last argument must be a function\n\t* @returns {void}\n\t*/\n\tfunction forEachAsync( collection, done ) {\n\t\tif ( !isCollection( collection ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a collection. Value: `%s`.', collection ) );\n\t\t}\n\t\tif ( !isFunction( done ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t\t}\n\t\treturn limit( collection, opts, f, clbk );\n\n\t\t/**\n\t\t* Callback invoked upon completion.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction clbk( error ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\tdone();\n\t\t}\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 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 isPositiveInteger } from '@stdlib/assert-is-positive-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 {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'thisArg': {},\n* 'series': false,\n* 'limit': 10\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, 'thisArg' ) ) {\n\t\topts.thisArg = options.thisArg;\n\t}\n\tif ( hasOwnProp( options, 'series' ) ) {\n\t\topts.series = options.series;\n\t\tif ( !isBoolean( opts.series ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'series', opts.series ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'limit' ) ) {\n\t\topts.limit = options.limit;\n\t\tif ( !isPositiveInteger( opts.limit ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport factory from './factory.js';\n\n\n// MAIN //\n\n/**\n* Invokes a function once for each element in a collection.\n*\n* ## Notes\n*\n* - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Collection} collection - input collection\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} fcn - function to invoke for each element in a collection\n* @param {Callback} done - function to invoke upon completion\n* @throws {TypeError} first argument must be a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} second-to-last argument must be a function\n* @throws {TypeError} last argument must be a function\n* @returns {void}\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function done( error ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( 'Successfully read all files.' );\n* }\n*\n* function read( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( error );\n* }\n* console.log( 'Successfully read file: %s', file );\n* next();\n* }\n* }\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* forEachAsync( files, read, done );\n*/\nfunction forEachAsync( collection, options, fcn, done ) {\n\tif ( arguments.length < 4 ) {\n\t\treturn factory( options )( collection, fcn );\n\t}\n\tfactory( options, fcn )( collection, done );\n}\n\n\n// EXPORTS //\n\nexport default forEachAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Invoke a function once for each element in a collection.\n*\n* @module @stdlib/utils-async-for-each\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n* import forEachAsync from '@stdlib/utils-async-for-each';\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* function done( error ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( 'Successfully read all files.' );\n* }\n*\n* function read( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* error = new Error( 'unable to read file: '+file );\n* return next( error );\n* }\n* console.log( 'Successfully read file: %s', file );\n* next();\n* }\n* }\n*\n* forEachAsync( files, read, done );\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'for-each-right-async:limit' );\n\n\n// MAIN //\n\n/**\n* Invokes a function once for each element in a collection, limiting the number of concurrently pending functions and iterating from right to left.\n*\n* @private\n* @param {Collection} collection - input collection\n* @param {Options} opts - function options\n* @param {*} [opts.thisArg] - execution context\n* @param {PositiveInteger} [opts.limit] - maximum number of pending function invocations\n* @param {Function} fcn - function to invoke\n* @param {Callback} done - function to invoke upon completion or upon encountering an error\n* @returns {void}\n*/\nfunction limit( collection, opts, fcn, done ) {\n\tvar count;\n\tvar flg;\n\tvar lim;\n\tvar len;\n\tvar idx;\n\tvar i;\n\n\tlen = collection.length;\n\tdebug( 'Collection length: %d', len );\n\n\tif ( len === 0 ) {\n\t\tdebug( 'Finished processing a collection.' );\n\t\treturn done();\n\t}\n\tif ( len < opts.limit ) {\n\t\tlim = len;\n\t} else {\n\t\tlim = opts.limit;\n\t}\n\tdebug( 'Concurrency limit: %d', lim );\n\tdebug( 'Number of arguments: %d', fcn.length );\n\n\tcount = 0;\n\tidx = len;\n\tfor ( i = 0; i < lim; i++ ) {\n\t\t// This guard is necessary to protect against synchronous functions which exhaust all collection elements...\n\t\tif ( idx > 0 ) {\n\t\t\tnext(); // eslint-disable-line node/callback-return\n\t\t}\n\t}\n\n\t/**\n\t* Callback to invoke a provided function for the next element in a collection.\n\t*\n\t* @private\n\t*/\n\tfunction next() {\n\t\tidx -= 1;\n\t\tdebug( 'Collection element %d: %s.', idx, JSON.stringify( collection[ idx ] ) );\n\t\tif ( fcn.length === 2 ) {\n\t\t\tfcn.call( opts.thisArg, collection[ idx ], clbk );\n\t\t} else if ( fcn.length === 3 ) {\n\t\t\tfcn.call( opts.thisArg, collection[ idx ], idx, clbk );\n\t\t} else {\n\t\t\tfcn.call( opts.thisArg, collection[ idx ], idx, collection, clbk );\n\t\t}\n\t}\n\n\t/**\n\t* Callback invoked once a provided function finishes processing a collection element.\n\t*\n\t* @private\n\t* @param {*} [error] - error\n\t* @returns {void}\n\t*/\n\tfunction clbk( error ) {\n\t\tif ( flg ) {\n\t\t\t// Prevent further processing of collection elements:\n\t\t\treturn;\n\t\t}\n\t\tif ( error ) {\n\t\t\tflg = true;\n\t\t\tdebug( 'Encountered an error: %s', error.message );\n\t\t\treturn done( error );\n\t\t}\n\t\tcount += 1;\n\t\tdebug( 'Processed %d of %d collection elements.', count, len );\n\t\tif ( idx > 0 ) {\n\t\t\treturn next();\n\t\t}\n\t\tif ( count === len ) {\n\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\treturn done();\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default limit;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isCollection from '@stdlib/assert-is-collection';\nimport format from '@stdlib/string-format';\nimport PINF from '@stdlib/constants-float64-pinf';\nimport validate from './validate.js';\nimport limit from './limit.js';\n\n\n// MAIN //\n\n/**\n* Returns a function to invoke a function once for each element in a collection, iterating from right to left.\n*\n* ## Notes\n*\n* - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} fcn - function to invoke for each element in a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} last argument must be a function\n* @returns {Function} function which invokes the provided function once for each element in a collection\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function read( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( error );\n* }\n* console.log( 'Successfully read file: %s', file );\n* next();\n* }\n* }\n*\n* var opts = {\n* 'series': true\n* };\n*\n* // Create a `forEachRightAsync` function which invokes `read` for each collection element sequentially:\n* var forEachRightAsync = factory( opts, read );\n*\n* // Create a collection over which to iterate:\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* // Define a callback which handles errors:\n* function done( error ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( 'Successfully read all files.' );\n* }\n*\n* // Run `read` for each element in `files`:\n* forEachRightAsync( files, done );\n*/\nfunction factory( options, fcn ) {\n\tvar opts;\n\tvar err;\n\tvar f;\n\n\topts = {};\n\tif ( arguments.length > 1 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t\tf = fcn;\n\t} else {\n\t\tf = options;\n\t}\n\tif ( !isFunction( f ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', f ) );\n\t}\n\tif ( opts.series ) {\n\t\topts.limit = 1;\n\t} else if ( !opts.limit ) {\n\t\topts.limit = PINF;\n\t}\n\treturn forEachRightAsync;\n\n\t/**\n\t* Invokes a function for each element in a collection, iterating from right to left.\n\t*\n\t* @private\n\t* @param {Collection} collection - input collection\n\t* @param {Callback} done - function to invoke upon completion\n\t* @throws {TypeError} first argument must be a collection\n\t* @throws {TypeError} last argument must be a function\n\t* @returns {void}\n\t*/\n\tfunction forEachRightAsync( collection, done ) {\n\t\tif ( !isCollection( collection ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a collection. Value: `%s`.', collection ) );\n\t\t}\n\t\tif ( !isFunction( done ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t\t}\n\t\treturn limit( collection, opts, f, clbk );\n\n\t\t/**\n\t\t* Callback invoked upon completion.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction clbk( error ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\tdone();\n\t\t}\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 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 isPositiveInteger } from '@stdlib/assert-is-positive-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 {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'thisArg': {},\n* 'series': false,\n* 'limit': 10\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, 'thisArg' ) ) {\n\t\topts.thisArg = options.thisArg;\n\t}\n\tif ( hasOwnProp( options, 'series' ) ) {\n\t\topts.series = options.series;\n\t\tif ( !isBoolean( opts.series ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'series', opts.series ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'limit' ) ) {\n\t\topts.limit = options.limit;\n\t\tif ( !isPositiveInteger( opts.limit ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport factory from './factory.js';\n\n\n// MAIN //\n\n/**\n* Invokes a function once for each element in a collection, iterating from right to left.\n*\n* ## Notes\n*\n* - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Collection} collection - input collection\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} fcn - function to invoke for each element in a collection\n* @param {Callback} done - function to invoke upon completion\n* @throws {TypeError} first argument must be a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} second-to-last argument must be a function\n* @throws {TypeError} last argument must be a function\n* @returns {void}\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function done( error ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( 'Successfully read all files.' );\n* }\n*\n* function read( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( error );\n* }\n* console.log( 'Successfully read file: %s', file );\n* next();\n* }\n* }\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* forEachRightAsync( files, read, done );\n*/\nfunction forEachRightAsync( collection, options, fcn, done ) {\n\tif ( arguments.length < 4 ) {\n\t\treturn factory( options )( collection, fcn );\n\t}\n\tfactory( options, fcn )( collection, done );\n}\n\n\n// EXPORTS //\n\nexport default forEachRightAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Invoke a function once for each element in a collection, iterating from right to left.\n*\n* @module @stdlib/utils-async-for-each-right\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n* import forEachRightAsync from '@stdlib/utils-async-for-each-right';\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* function done( error ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( 'Successfully read all files.' );\n* }\n*\n* function read( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* error = new Error( 'unable to read file: '+file );\n* return next( error );\n* }\n* console.log( 'Successfully read file: %s', file );\n* next();\n* }\n* }\n*\n* forEachRightAsync( files, read, done );\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport 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 isPositiveInteger } from '@stdlib/assert-is-positive-integer';\nimport indexOf from '@stdlib/utils-index-of';\nimport format from '@stdlib/string-format';\n\n\n// VARIABLES //\n\nvar returns = [ 'values', 'indices', '*' ];\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 {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {string} [options.returns] - output format\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'thisArg': {},\n* 'series': false,\n* 'limit': 10,\n* 'returns': '*'\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, 'thisArg' ) ) {\n\t\topts.thisArg = options.thisArg;\n\t}\n\tif ( hasOwnProp( options, 'series' ) ) {\n\t\topts.series = options.series;\n\t\tif ( !isBoolean( opts.series ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'series', opts.series ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'limit' ) ) {\n\t\topts.limit = options.limit;\n\t\tif ( !isPositiveInteger( opts.limit ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'returns' ) ) {\n\t\topts.returns = options.returns;\n\t\tif ( indexOf( returns, opts.returns ) === -1 ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be one of the following: \"%s\". Option: `%s`.', 'returns', returns.join( '\", \"' ), opts.returns ) );\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 hasOwnProp from '@stdlib/assert-has-own-property';\n\n\n// VARIABLES //\n\nvar debug = logger( 'group-by-async:limit' );\n\n\n// MAIN //\n\n/**\n* Invokes an indicator function once for each element in a collection, limiting the number of concurrently pending functions.\n*\n* ## Notes\n*\n* - We need to cache the collection value to prevent the edge case where, during the invocation of the indicator function, the element at index `i` is swapped for some other value. For some, that might be a feature; here, we take the stance that one should be less clever.\n* - Checking for an \"own\" property is necessary to guard against the edge case where an indicator function returns a group identifier which matches a method or property on the `Object` prototype.\n*\n* @private\n* @param {Collection} collection - input collection\n* @param {Options} opts - function options\n* @param {*} [opts.thisArg] - execution context\n* @param {PositiveInteger} [opts.limit] - maximum number of pending function invocations\n* @param {string} [options.returns] - output format\n* @param {Function} indicator - indicator function\n* @param {Callback} done - function to invoke upon completion or upon encountering an error\n* @returns {void}\n*/\nfunction limit( collection, opts, indicator, done ) {\n\tvar maxIndex;\n\tvar count;\n\tvar flg;\n\tvar lim;\n\tvar len;\n\tvar idx;\n\tvar out;\n\tvar i;\n\n\tlen = collection.length;\n\tdebug( 'Collection length: %d', len );\n\n\tout = {};\n\tif ( len === 0 ) {\n\t\tdebug( 'Finished processing a collection.' );\n\t\treturn done( null, out );\n\t}\n\tif ( len < opts.limit ) {\n\t\tlim = len;\n\t} else {\n\t\tlim = opts.limit;\n\t}\n\tdebug( 'Concurrency limit: %d', lim );\n\tdebug( 'Number of arguments: %d', indicator.length );\n\n\tmaxIndex = len - 1;\n\tcount = 0;\n\tidx = -1;\n\tfor ( i = 0; i < lim; i++ ) {\n\t\t// This guard is necessary to protect against synchronous functions which exhaust all collection elements...\n\t\tif ( idx < maxIndex ) {\n\t\t\tnext(); // eslint-disable-line node/callback-return\n\t\t}\n\t}\n\t/**\n\t* Callback to invoke a provided function for the next element in a collection.\n\t*\n\t* @private\n\t*/\n\tfunction next() {\n\t\tvar v;\n\t\tvar j;\n\n\t\tidx += 1;\n\t\tj = idx;\n\t\tv = collection[ j ];\n\n\t\tdebug( 'Collection element %d: %s.', j, JSON.stringify( v ) );\n\t\tif ( indicator.length === 2 ) {\n\t\t\tindicator.call( opts.thisArg, v, cb );\n\t\t} else if ( indicator.length === 3 ) {\n\t\t\tindicator.call( opts.thisArg, v, j, cb );\n\t\t} else {\n\t\t\tindicator.call( opts.thisArg, v, j, collection, cb );\n\t\t}\n\t\t/**\n\t\t* Callback invoked once a provided function finishes processing a collection element.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {*} [group] - group\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction cb( error, group ) {\n\t\t\tif ( flg ) {\n\t\t\t\t// Prevent further processing of collection elements:\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( error ) {\n\t\t\t\tflg = true;\n\t\t\t\treturn clbk( error );\n\t\t\t}\n\t\t\tdebug( 'Collection element %d group: %s.', j, group );\n\n\t\t\t// Default is to return values...\n\t\t\tif ( opts.returns === 'indices' ) {\n\t\t\t\tif ( hasOwnProp( out, group ) ) {\n\t\t\t\t\tout[ group ].push( j );\n\t\t\t\t} else {\n\t\t\t\t\tout[ group ] = [ j ];\n\t\t\t\t}\n\t\t\t} else if ( opts.returns === '*' ) {\n\t\t\t\tif ( hasOwnProp( out, group ) ) {\n\t\t\t\t\tout[ group ].push( [ j, v ] );\n\t\t\t\t} else {\n\t\t\t\t\tout[ group ] = [ [ j, v ] ];\n\t\t\t\t}\n\t\t\t} else if ( hasOwnProp( out, group ) ) {\n\t\t\t\tout[ group ].push( v );\n\t\t\t} else {\n\t\t\t\tout[ group ] = [ v ];\n\t\t\t}\n\t\t\tclbk();\n\t\t}\n\t}\n\n\t/**\n\t* Callback invoked once ready to process the next collection element.\n\t*\n\t* @private\n\t* @param {*} [error] - error\n\t* @returns {void}\n\t*/\n\tfunction clbk( error ) {\n\t\tif ( error ) {\n\t\t\tdebug( 'Encountered an error: %s', error.message );\n\t\t\treturn done( error );\n\t\t}\n\t\tcount += 1;\n\t\tdebug( 'Processed %d of %d collection elements.', count, len );\n\t\tif ( idx < maxIndex ) {\n\t\t\treturn next();\n\t\t}\n\t\tif ( count === len ) {\n\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\treturn done( null, out );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default limit;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isCollection from '@stdlib/assert-is-collection';\nimport format from '@stdlib/string-format';\nimport PINF from '@stdlib/constants-float64-pinf';\nimport validate from './validate.js';\nimport limit from './limit.js';\n\n\n// MAIN //\n\n/**\n* Returns a function for grouping values according to an indicator function.\n*\n* ## Notes\n*\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {string} [options.returns=\"values\"] - if `values`, values are returned; if `indices`, indices are returned; if `*`, both indices and values are returned\n* @param {Function} indicator - indicator function specifying which group an element in the input collection belongs to\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} last argument must be a function\n* @returns {Function} function which invokes the indicator function once for each element in a collection\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function indicator( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, 'nonreadable' );\n* }\n* next( null, 'readable' );\n* }\n* }\n*\n* var opts = {\n* 'series': true\n* };\n*\n* // Create a `groupByAsync` function which invokes the indicator function for each collection element sequentially:\n* var groupByAsync = factory( opts, indicator );\n*\n* // Create a collection over which to iterate:\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* // Define a callback which handles results:\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* }\n*\n* // Try to read each element in `files`:\n* groupByAsync( files, done );\n*/\nfunction factory( options, indicator ) {\n\tvar opts;\n\tvar err;\n\tvar f;\n\n\topts = {};\n\tif ( arguments.length > 1 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t\tf = indicator;\n\t} else {\n\t\tf = options;\n\t}\n\tif ( !isFunction( f ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', f ) );\n\t}\n\tif ( opts.series ) {\n\t\topts.limit = 1;\n\t} else if ( !opts.limit ) {\n\t\topts.limit = PINF;\n\t}\n\treturn groupByAsync;\n\n\t/**\n\t* Invokes an indicator function for each element in a collection.\n\t*\n\t* @private\n\t* @param {Collection} collection - input collection\n\t* @param {Callback} done - function to invoke upon completion\n\t* @throws {TypeError} first argument must be a collection\n\t* @throws {TypeError} last argument must be a function\n\t* @returns {void}\n\t*/\n\tfunction groupByAsync( collection, done ) {\n\t\tif ( !isCollection( collection ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a collection. Value: `%s`.', collection ) );\n\t\t}\n\t\tif ( !isFunction( done ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t\t}\n\t\treturn limit( collection, opts, f, clbk );\n\n\t\t/**\n\t\t* Callback invoked upon completion.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {Object} result - group-by result\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction clbk( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\tdone( null, result );\n\t\t}\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 factory from './factory.js';\n\n\n// MAIN //\n\n/**\n* Groups values according to an indicator function.\n*\n* ## Notes\n*\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Collection} collection - input collection\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {string} [options.returns=\"values\"] - if `values`, values are returned; if `indices`, indices are returned; if `*`, both indices and values are returned\n* @param {Function} indicator - indicator function specifying which group an element in the input collection belongs to\n* @param {Callback} done - function to invoke upon completion\n* @throws {TypeError} first argument must be a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} second-to-last argument must be a function\n* @throws {TypeError} last argument must be a function\n* @returns {void}\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* }\n*\n* function indicator( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, 'nonreadable' );\n* }\n* next( null, 'readable' );\n* }\n* }\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* groupByAsync( files, indicator, done );\n*/\nfunction groupByAsync( collection, options, indicator, done ) {\n\tif ( arguments.length < 4 ) {\n\t\treturn factory( options )( collection, indicator );\n\t}\n\tfactory( options, indicator )( collection, done );\n}\n\n\n// EXPORTS //\n\nexport default groupByAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Group values according to an indicator function.\n*\n* @module @stdlib/utils-async-group-by\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n* import groupByAsync from '@stdlib/utils-async-group-by';\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* }\n*\n* function indicator( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, 'nonreadable' );\n* }\n* next( null, 'readable' );\n* }\n* }\n*\n* groupByAsync( files, indicator, done );\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'inmap-async:limit' );\n\n\n// MAIN //\n\n/**\n* Invokes a function once for each element in a collection, limiting the number of concurrently pending functions, and updates a collection in-place.\n*\n* @private\n* @param {Collection} collection - input collection\n* @param {Options} opts - function options\n* @param {*} [opts.thisArg] - execution context\n* @param {PositiveInteger} [opts.limit] - maximum number of pending function invocations\n* @param {Function} fcn - function to invoke\n* @param {Callback} done - function to invoke upon completion or upon encountering an error\n* @returns {void}\n*/\nfunction limit( collection, opts, fcn, done ) {\n\tvar maxIndex;\n\tvar count;\n\tvar flg;\n\tvar lim;\n\tvar len;\n\tvar idx;\n\tvar i;\n\n\tlen = collection.length;\n\tdebug( 'Collection length: %d', len );\n\n\tif ( len === 0 ) {\n\t\tdebug( 'Finished processing a collection.' );\n\t\treturn done();\n\t}\n\tif ( len < opts.limit ) {\n\t\tlim = len;\n\t} else {\n\t\tlim = opts.limit;\n\t}\n\tdebug( 'Concurrency limit: %d', lim );\n\tdebug( 'Number of arguments: %d', fcn.length );\n\n\tmaxIndex = len - 1;\n\tcount = 0;\n\tidx = -1;\n\tfor ( i = 0; i < lim; i++ ) {\n\t\t// This guard is necessary to protect against synchronous functions which exhaust all collection elements...\n\t\tif ( idx < maxIndex ) {\n\t\t\tnext(); // eslint-disable-line node/callback-return\n\t\t}\n\t}\n\t/**\n\t* Callback to invoke a provided function for the next element in a collection.\n\t*\n\t* @private\n\t*/\n\tfunction next() {\n\t\tvar j;\n\t\tidx += 1;\n\t\tj = idx;\n\t\tdebug( 'Collection element %d: %s.', j, JSON.stringify( collection[ j ] ) );\n\t\tif ( fcn.length === 2 ) {\n\t\t\tfcn.call( opts.thisArg, collection[ j ], cb );\n\t\t} else if ( fcn.length === 3 ) {\n\t\t\tfcn.call( opts.thisArg, collection[ j ], j, cb );\n\t\t} else {\n\t\t\tfcn.call( opts.thisArg, collection[ j ], j, collection, cb );\n\t\t}\n\t\t/**\n\t\t* Callback invoked once a provided function finishes processing a collection element.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {*} [result] - result\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction cb( error, result ) {\n\t\t\tif ( flg ) {\n\t\t\t\t// Prevent further processing of collection elements:\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( error ) {\n\t\t\t\tflg = true;\n\t\t\t\treturn clbk( error );\n\t\t\t}\n\t\t\tcollection[ j ] = result;\n\t\t\tclbk();\n\t\t}\n\t}\n\n\t/**\n\t* Callback invoked once ready to process the next collection element.\n\t*\n\t* @private\n\t* @param {*} [error] - error\n\t* @returns {void}\n\t*/\n\tfunction clbk( error ) {\n\t\tif ( error ) {\n\t\t\tdebug( 'Encountered an error: %s', error.message );\n\t\t\treturn done( error );\n\t\t}\n\t\tcount += 1;\n\t\tdebug( 'Processed %d of %d collection elements.', count, len );\n\t\tif ( idx < maxIndex ) {\n\t\t\treturn next();\n\t\t}\n\t\tif ( count === len ) {\n\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\treturn done();\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default limit;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isCollection from '@stdlib/assert-is-collection';\nimport format from '@stdlib/string-format';\nimport PINF from '@stdlib/constants-float64-pinf';\nimport validate from './validate.js';\nimport limit from './limit.js';\n\n\n// MAIN //\n\n/**\n* Returns a function to invoke a function once for each element in a collection and to update the collection in-place.\n*\n* ## Notes\n*\n* - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling. Note, however, that the function may have mutated an input collection during prior invocations, resulting in a partially mutated collection.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} fcn - function to invoke for each element in a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} last argument must be a function\n* @returns {Function} function which invokes the provided function once for each element in a collection\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function read( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error, data ) {\n* if ( error ) {\n* return next( error );\n* }\n* next( null, data );\n* }\n* }\n*\n* var opts = {\n* 'series': true\n* };\n*\n* // Create a `inmapAsync` function which invokes `read` for each collection element sequentially:\n* var inmapAsync = factory( opts, read );\n*\n* // Create a collection over which to iterate:\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* // Define a callback which handles errors:\n* function done( error, results ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( results );\n* }\n*\n* // Run `read` for each element in `files`:\n* inmapAsync( files, done );\n*/\nfunction factory( options, fcn ) {\n\tvar opts;\n\tvar err;\n\tvar f;\n\n\topts = {};\n\tif ( arguments.length > 1 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t\tf = fcn;\n\t} else {\n\t\tf = options;\n\t}\n\tif ( !isFunction( f ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', f ) );\n\t}\n\tif ( opts.series ) {\n\t\topts.limit = 1;\n\t} else if ( !opts.limit ) {\n\t\topts.limit = PINF;\n\t}\n\treturn inmapAsync;\n\n\t/**\n\t* Invokes a function for each element in a collection and updates a collection in-place.\n\t*\n\t* @private\n\t* @param {Collection} collection - input collection\n\t* @param {Callback} done - function to invoke upon completion\n\t* @throws {TypeError} first argument must be a collection\n\t* @throws {TypeError} last argument must be a function\n\t* @returns {void}\n\t*/\n\tfunction inmapAsync( collection, done ) {\n\t\tif ( !isCollection( collection ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a collection. Value: `%s`.', collection ) );\n\t\t}\n\t\tif ( !isFunction( done ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t\t}\n\t\treturn limit( collection, opts, f, clbk );\n\n\t\t/**\n\t\t* Callback invoked upon completion.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction clbk( error ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error, collection );\n\t\t\t}\n\t\t\tdone( null, collection );\n\t\t}\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 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 isPositiveInteger } from '@stdlib/assert-is-positive-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 {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'thisArg': {},\n* 'series': false,\n* 'limit': 10\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, 'thisArg' ) ) {\n\t\topts.thisArg = options.thisArg;\n\t}\n\tif ( hasOwnProp( options, 'series' ) ) {\n\t\topts.series = options.series;\n\t\tif ( !isBoolean( opts.series ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'series', opts.series ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'limit' ) ) {\n\t\topts.limit = options.limit;\n\t\tif ( !isPositiveInteger( opts.limit ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport factory from './factory.js';\n\n\n// MAIN //\n\n/**\n* Invokes a function once for each element in a collection and updates a collection in-place.\n*\n* ## Notes\n*\n* - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling. Note, however, that the function may have mutated an input collection during prior invocations, resulting in a partially mutated collection.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Collection} collection - input collection\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} fcn - function to invoke for each element in a collection\n* @param {Callback} done - function to invoke upon completion\n* @throws {TypeError} first argument must be a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} second-to-last argument must be a function\n* @throws {TypeError} last argument must be a function\n* @returns {void}\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function done( error, results ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( results );\n* }\n*\n* function read( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error, data ) {\n* if ( error ) {\n* return next( error );\n* }\n* next( null, data );\n* }\n* }\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* inmapAsync( files, read, done );\n*/\nfunction inmapAsync( collection, options, fcn, done ) {\n\tif ( arguments.length < 4 ) {\n\t\treturn factory( options )( collection, fcn );\n\t}\n\tfactory( options, fcn )( collection, done );\n}\n\n\n// EXPORTS //\n\nexport default inmapAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Invoke a function once for each element in a collection and update a collection in-place.\n*\n* @module @stdlib/utils-async-inmap\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n* import inmapAsync from '@stdlib/utils-async-inmap';\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* function done( error, results ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( results );\n* }\n*\n* function read( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error, data ) {\n* if ( error ) {\n* error = new Error( 'unable to read file: '+file );\n* return next( error );\n* }\n* next( null, data );\n* }\n* }\n*\n* inmapAsync( files, read, done );\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'inmap-right-async:limit' );\n\n\n// MAIN //\n\n/**\n* Invokes a function once for each element in a collection, limiting the number of concurrently pending functions and iterating from right to left, and updates a collection in-place.\n*\n* @private\n* @param {Collection} collection - input collection\n* @param {Options} opts - function options\n* @param {*} [opts.thisArg] - execution context\n* @param {PositiveInteger} [opts.limit] - maximum number of pending function invocations\n* @param {Function} fcn - function to invoke\n* @param {Callback} done - function to invoke upon completion or upon encountering an error\n* @returns {void}\n*/\nfunction limit( collection, opts, fcn, done ) {\n\tvar count;\n\tvar flg;\n\tvar lim;\n\tvar len;\n\tvar idx;\n\tvar i;\n\n\tlen = collection.length;\n\tdebug( 'Collection length: %d', len );\n\n\tif ( len === 0 ) {\n\t\tdebug( 'Finished processing a collection.' );\n\t\treturn done();\n\t}\n\tif ( len < opts.limit ) {\n\t\tlim = len;\n\t} else {\n\t\tlim = opts.limit;\n\t}\n\tdebug( 'Concurrency limit: %d', lim );\n\tdebug( 'Number of arguments: %d', fcn.length );\n\n\tcount = 0;\n\tidx = len;\n\tfor ( i = 0; i < lim; i++ ) {\n\t\t// This guard is necessary to protect against synchronous functions which exhaust all collection elements...\n\t\tif ( idx > 0 ) {\n\t\t\tnext(); // eslint-disable-line node/callback-return\n\t\t}\n\t}\n\t/**\n\t* Callback to invoke a provided function for the next element in a collection.\n\t*\n\t* @private\n\t*/\n\tfunction next() {\n\t\tvar j;\n\t\tidx -= 1;\n\t\tj = idx;\n\t\tdebug( 'Collection element %d: %s.', j, JSON.stringify( collection[ j ] ) );\n\t\tif ( fcn.length === 2 ) {\n\t\t\tfcn.call( opts.thisArg, collection[ j ], cb );\n\t\t} else if ( fcn.length === 3 ) {\n\t\t\tfcn.call( opts.thisArg, collection[ j ], j, cb );\n\t\t} else {\n\t\t\tfcn.call( opts.thisArg, collection[ j ], j, collection, cb );\n\t\t}\n\t\t/**\n\t\t* Callback invoked once a provided function finishes processing a collection element.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {*} [result] - result\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction cb( error, result ) {\n\t\t\tif ( flg ) {\n\t\t\t\t// Prevent further processing of collection elements:\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( error ) {\n\t\t\t\tflg = true;\n\t\t\t\treturn clbk( error );\n\t\t\t}\n\t\t\tcollection[ j ] = result;\n\t\t\tclbk();\n\t\t}\n\t}\n\n\t/**\n\t* Callback invoked once ready to process the next collection element.\n\t*\n\t* @private\n\t* @param {*} [error] - error\n\t* @returns {void}\n\t*/\n\tfunction clbk( error ) {\n\t\tif ( error ) {\n\t\t\tdebug( 'Encountered an error: %s', error.message );\n\t\t\treturn done( error );\n\t\t}\n\t\tcount += 1;\n\t\tdebug( 'Processed %d of %d collection elements.', count, len );\n\t\tif ( idx > 0 ) {\n\t\t\treturn next();\n\t\t}\n\t\tif ( count === len ) {\n\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\treturn done();\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default limit;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isCollection from '@stdlib/assert-is-collection';\nimport format from '@stdlib/string-format';\nimport PINF from '@stdlib/constants-float64-pinf';\nimport validate from './validate.js';\nimport limit from './limit.js';\n\n\n// MAIN //\n\n/**\n* Returns a function to invoke a function once for each element in a collection and to update the collection in-place, iterating from right to left.\n*\n* ## Notes\n*\n* - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling. Note, however, that the function may have mutated an input collection during prior invocations, resulting in a partially mutated collection.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} fcn - function to invoke for each element in a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} last argument must be a function\n* @returns {Function} function which invokes the provided function once for each element in a collection\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function read( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error, data ) {\n* if ( error ) {\n* return next( error );\n* }\n* next( null, data );\n* }\n* }\n*\n* var opts = {\n* 'series': true\n* };\n*\n* // Create a `inmapRightAsync` function which invokes `read` for each collection element sequentially:\n* var inmapRightAsync = factory( opts, read );\n*\n* // Create a collection over which to iterate:\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* // Define a callback which handles errors:\n* function done( error, results ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( results );\n* }\n*\n* // Run `read` for each element in `files`:\n* inmapRightAsync( files, done );\n*/\nfunction factory( options, fcn ) {\n\tvar opts;\n\tvar err;\n\tvar f;\n\n\topts = {};\n\tif ( arguments.length > 1 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t\tf = fcn;\n\t} else {\n\t\tf = options;\n\t}\n\tif ( !isFunction( f ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', f ) );\n\t}\n\tif ( opts.series ) {\n\t\topts.limit = 1;\n\t} else if ( !opts.limit ) {\n\t\topts.limit = PINF;\n\t}\n\treturn inmapRightAsync;\n\n\t/**\n\t* Invokes a function for each element in a collection and updates a collection in-place, iterating from right to left.\n\t*\n\t* @private\n\t* @param {Collection} collection - input collection\n\t* @param {Callback} done - function to invoke upon completion\n\t* @throws {TypeError} first argument must be a collection\n\t* @throws {TypeError} last argument must be a function\n\t* @returns {void}\n\t*/\n\tfunction inmapRightAsync( collection, done ) {\n\t\tif ( !isCollection( collection ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a collection. Value: `%s`.', collection ) );\n\t\t}\n\t\tif ( !isFunction( done ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t\t}\n\t\treturn limit( collection, opts, f, clbk );\n\n\t\t/**\n\t\t* Callback invoked upon completion.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction clbk( error ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error, collection );\n\t\t\t}\n\t\t\tdone( null, collection );\n\t\t}\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 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 isPositiveInteger } from '@stdlib/assert-is-positive-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 {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'thisArg': {},\n* 'series': false,\n* 'limit': 10\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, 'thisArg' ) ) {\n\t\topts.thisArg = options.thisArg;\n\t}\n\tif ( hasOwnProp( options, 'series' ) ) {\n\t\topts.series = options.series;\n\t\tif ( !isBoolean( opts.series ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'series', opts.series ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'limit' ) ) {\n\t\topts.limit = options.limit;\n\t\tif ( !isPositiveInteger( opts.limit ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport factory from './factory.js';\n\n\n// MAIN //\n\n/**\n* Invokes a function once for each element in a collection and updates a collection in-place, iterating from right to left.\n*\n* ## Notes\n*\n* - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling. Note, however, that the function may have mutated an input collection during prior invocations, resulting in a partially mutated collection.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Collection} collection - input collection\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} fcn - function to invoke for each element in a collection\n* @param {Callback} done - function to invoke upon completion\n* @throws {TypeError} first argument must be a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} second-to-last argument must be a function\n* @throws {TypeError} last argument must be a function\n* @returns {void}\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function done( error, results ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( results );\n* }\n*\n* function read( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error, data ) {\n* if ( error ) {\n* return next( error );\n* }\n* next( null, data );\n* }\n* }\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* inmapRightAsync( files, read, done );\n*/\nfunction inmapRightAsync( collection, options, fcn, done ) {\n\tif ( arguments.length < 4 ) {\n\t\treturn factory( options )( collection, fcn );\n\t}\n\tfactory( options, fcn )( collection, done );\n}\n\n\n// EXPORTS //\n\nexport default inmapRightAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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* Invoke a function once for each element in a collection and update a collection in-place, iterating from right to left.\n*\n* @module @stdlib/utils-async-inmap-right\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n* import inmapRightAsync from '@stdlib/utils-async-inmap-right';\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* function done( error, results ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( results );\n* }\n*\n* function read( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error, data ) {\n* if ( error ) {\n* error = new Error( 'unable to read file: '+file );\n* return next( error );\n* }\n* next( null, data );\n* }\n* }\n*\n* inmapRightAsync( files, read, done );\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\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// VARIABLES //\n\nvar debug = logger( 'map-function-async:limit' );\n\n\n// MAIN //\n\n/**\n* Invokes a function `n` times, limiting the number of concurrently pending invocations, and returns an array of accumulated function return values.\n*\n* @private\n* @param {NonNegativeInteger} n - number of function invocations\n* @param {Options} opts - function options\n* @param {*} [opts.thisArg] - execution context\n* @param {PositiveInteger} [opts.limit] - maximum number of pending function invocations\n* @param {Function} fcn - function to invoke\n* @param {Callback} done - function to invoke upon completion or upon encountering an error\n* @returns {void}\n*/\nfunction limit( n, opts, fcn, done ) {\n\tvar count;\n\tvar flg;\n\tvar out;\n\tvar lim;\n\tvar idx;\n\tvar m;\n\tvar i;\n\n\tdebug( 'Number of invocations: %d', n );\n\n\t// Note: we explicitly preallocate in order to facilitate inserting a function result into its associated output array index. This means we do not ensure \"fast\" elements for large output arrays.\n\tout = new Array( n );\n\tif ( n === 0 ) {\n\t\tdebug( 'Finished invoking a function.' );\n\t\treturn done( null, out );\n\t}\n\tif ( n < opts.limit ) {\n\t\tlim = n;\n\t} else {\n\t\tlim = opts.limit;\n\t}\n\tdebug( 'Concurrency limit: %d', lim );\n\n\tcount = 0;\n\tidx = -1;\n\tm = n - 1;\n\tfor ( i = 0; i < lim; i++ ) {\n\t\t// This guard is necessary to protect against synchronous functions which exhaust all invocations...\n\t\tif ( idx < m ) {\n\t\t\tnext(); // eslint-disable-line node/callback-return\n\t\t}\n\t}\n\t/**\n\t* Callback to process the next function invocation.\n\t*\n\t* @private\n\t*/\n\tfunction next() {\n\t\tvar j;\n\t\tidx += 1;\n\t\tj = idx;\n\t\tdebug( 'Invocation number: %d', j );\n\t\tfcn.call( opts.thisArg, j, cb );\n\n\t\t/**\n\t\t* Callback invoked once a provided function completes.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {*} [result] - result\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction cb( error, result ) {\n\t\t\tif ( flg ) {\n\t\t\t\t// Prevent further invocations:\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( error ) {\n\t\t\t\tflg = true;\n\t\t\t\treturn clbk( error );\n\t\t\t}\n\t\t\tout[ j ] = result;\n\t\t\tclbk();\n\t\t}\n\t}\n\n\t/**\n\t* Callback invoked once ready to process the next invocation.\n\t*\n\t* @private\n\t* @param {*} [error] - error\n\t* @returns {void}\n\t*/\n\tfunction clbk( error ) {\n\t\tif ( error ) {\n\t\t\tdebug( 'Encountered an error: %s', error.message );\n\t\t\treturn done( error );\n\t\t}\n\t\tcount += 1;\n\t\tdebug( 'Completed invocation %d of %d.', count, n );\n\t\tif ( idx < m ) {\n\t\t\treturn next();\n\t\t}\n\t\tif ( count === n ) {\n\t\t\tdebug( 'Finished invoking a function.' );\n\t\t\treturn done( null, out );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default limit;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isFunction from '@stdlib/assert-is-function';\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert-is-nonnegative-integer';\nimport format from '@stdlib/string-format';\nimport PINF from '@stdlib/constants-float64-pinf';\nimport validate from './validate.js';\nimport limit from './limit.js';\n\n\n// MAIN //\n\n/**\n* Returns a function to invoke a function `n` times and return an array of accumulated function return values.\n*\n* ## Notes\n*\n* - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function again\n* @param {Function} fcn - function to invoke\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} last argument must be a function\n* @returns {Function} function which invokes a function `n` times and returns an array of accumulated function return values\n*\n* @example\n* function fcn( i, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, i );\n* }\n* }\n*\n* var opts = {\n* 'series': true\n* };\n*\n* var mapFunAsync = factory( opts, fcn );\n*\n* function done( error, results ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( results );\n* }\n*\n* mapFunAsync( 10, done );\n*/\nfunction factory( options, fcn ) {\n\tvar opts;\n\tvar err;\n\tvar f;\n\n\topts = {};\n\tif ( arguments.length > 1 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t\tf = fcn;\n\t} else {\n\t\tf = options;\n\t}\n\tif ( !isFunction( f ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', f ) );\n\t}\n\tif ( opts.series ) {\n\t\topts.limit = 1;\n\t} else if ( !opts.limit ) {\n\t\topts.limit = PINF;\n\t}\n\treturn mapFunAsync;\n\n\t/**\n\t* Invokes a function `n` times and returns an array of accumulated function return values.\n\t*\n\t* @private\n\t* @param {NonNegativeInteger} n - number of function invocations\n\t* @param {Callback} done - function to invoke upon completion\n\t* @throws {TypeError} first argument must be a nonnegative integer\n\t* @throws {TypeError} last argument must be a function\n\t* @returns {void}\n\t*/\n\tfunction mapFunAsync( n, done ) {\n\t\tif ( !isNonNegativeInteger( n ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Number of function invocations must be a nonnegative integer. Value: `%s`.', n ) );\n\t\t}\n\t\tif ( !isFunction( done ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t\t}\n\t\treturn limit( n, opts, f, clbk );\n\n\t\t/**\n\t\t* Callback invoked upon completion.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {Array} results - results\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction clbk( error, results ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\tdone( null, results );\n\t\t}\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 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 isPositiveInteger } from '@stdlib/assert-is-positive-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 {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series] - boolean indicating whether to wait for a previous invocation to complete before the next invocation\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'thisArg': {},\n* 'series': false,\n* 'limit': 10\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, 'thisArg' ) ) {\n\t\topts.thisArg = options.thisArg;\n\t}\n\tif ( hasOwnProp( options, 'series' ) ) {\n\t\topts.series = options.series;\n\t\tif ( !isBoolean( opts.series ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'series', opts.series ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'limit' ) ) {\n\t\topts.limit = options.limit;\n\t\tif ( !isPositiveInteger( opts.limit ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport factory from './factory.js';\n\n\n// MAIN //\n\n/**\n* Invokes a function `n` times and returns an array of accumulated function return values.\n*\n* ## Notes\n*\n* - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Function} fcn - function to invoke\n* @param {NonNegativeInteger} n - number of function invocations\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function again\n* @param {Function} done - callback to invoke upon invoking a function `n` times\n* @throws {TypeError} first argument must be a function\n* @throws {TypeError} second argument must be a nonnegative integer\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} last argument must be a function\n* @returns {void}\n*\n* @example\n* function fcn( i, next ) {\n* setTimeout( onTimeout, i );\n* function onTimeout() {\n* next( null, i );\n* }\n* }\n*\n* function done( error, out ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( JSON.stringify( out ) );\n* // => [ 0, 1, 2, 3, 4 ]\n* }\n*\n* mapFunAsync( fcn, 5, done );\n*/\nfunction mapFunAsync( fcn, n, options, done ) {\n\tif ( arguments.length < 4 ) {\n\t\treturn factory( fcn )( n, options );\n\t}\n\tfactory( options, fcn )( n, done );\n}\n\n\n// EXPORTS //\n\nexport default mapFunAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* 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/**\n* Invoke a function `n` times and return an array of accumulated function return values.\n*\n* @module @stdlib/utils-async-map-function\n*\n* @example\n* import mapFunAsync from '@stdlib/utils-async-map-function';\n*\n* function fcn( i, next ) {\n* setTimeout( onTimeout, i );\n* function onTimeout() {\n* next( null, i );\n* }\n* }\n*\n* function done( error, out ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( JSON.stringify( out ) );\n* // => [ 0, 1, 2, 3, 4 ]\n* }\n*\n* mapFunAsync( fcn, 5, done );\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// 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// 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* 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/**\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// 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// 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// MODULES //\n\nvar logger = require( 'debug' );\nimport objectKeys from '@stdlib/utils-keys';\n\n\n// VARIABLES //\n\nvar debug = logger( 'map-values-async:limit' );\n\n\n// MAIN //\n\n/**\n* Invokes a function once for each own property in a source object, limiting the number of concurrently pending functions.\n*\n* ## Notes\n*\n* - Iteration order is **not** guaranteed.\n* - We need to cache an object value to prevent the edge case where, during the invocation of the transform function, the value corresponding to a particular key is swapped for some other value. For some, that might be a feature; here, we take the stance that one should be less clever.\n*\n* @private\n* @param {Object} obj - source object\n* @param {Options} opts - function options\n* @param {*} [opts.thisArg] - execution context\n* @param {PositiveInteger} [opts.limit] - maximum number of pending function invocations\n* @param {Function} fcn - function to invoke\n* @param {Callback} done - function to invoke upon completion or upon encountering an error\n* @returns {void}\n*/\nfunction limit( obj, opts, fcn, done ) {\n\tvar maxIndex;\n\tvar count;\n\tvar keys;\n\tvar flg;\n\tvar lim;\n\tvar len;\n\tvar idx;\n\tvar out;\n\tvar i;\n\n\tkeys = objectKeys( obj );\n\tlen = keys.length;\n\tdebug( 'Number of keys: %d', len );\n\n\tout = {};\n\tif ( len === 0 ) {\n\t\tdebug( 'Finished processing an object.' );\n\t\treturn done( null, out );\n\t}\n\tif ( len < opts.limit ) {\n\t\tlim = len;\n\t} else {\n\t\tlim = opts.limit;\n\t}\n\tdebug( 'Concurrency limit: %d', lim );\n\tdebug( 'Number of arguments: %d', fcn.length );\n\n\tmaxIndex = len - 1;\n\tcount = 0;\n\tidx = -1;\n\tfor ( i = 0; i < lim; i++ ) {\n\t\t// This guard is necessary to protect against synchronous functions which exhaust all properties...\n\t\tif ( idx < maxIndex ) {\n\t\t\tnext(); // eslint-disable-line node/callback-return\n\t\t}\n\t}\n\t/**\n\t* Callback to invoke a provided function for the next property.\n\t*\n\t* @private\n\t*/\n\tfunction next() {\n\t\tvar value;\n\t\tvar key;\n\n\t\tidx += 1;\n\t\tkey = keys[ idx ];\n\n\t\tvalue = obj[ key ];\n\t\tdebug( '%s: %s', key, JSON.stringify( value ) );\n\n\t\tif ( fcn.length === 2 ) {\n\t\t\tfcn.call( opts.thisArg, key, cb );\n\t\t} else if ( fcn.length === 3 ) {\n\t\t\tfcn.call( opts.thisArg, key, value, cb );\n\t\t} else {\n\t\t\tfcn.call( opts.thisArg, key, value, obj, cb );\n\t\t}\n\t\t/**\n\t\t* Callback invoked once a provided function finishes transforming a property.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {*} [key] - transformed key\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction cb( error, key ) {\n\t\t\tif ( flg ) {\n\t\t\t\t// Prevent further processing of properties:\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( error ) {\n\t\t\t\tflg = true;\n\t\t\t\treturn clbk( error );\n\t\t\t}\n\t\t\tdebug( 'Transform result => %s: %s', key, JSON.stringify( value ) );\n\t\t\tout[ key ] = value;\n\t\t\tclbk();\n\t\t}\n\t}\n\n\t/**\n\t* Callback invoked once ready to process the next property.\n\t*\n\t* @private\n\t* @param {*} [error] - error\n\t* @returns {void}\n\t*/\n\tfunction clbk( error ) {\n\t\tif ( error ) {\n\t\t\tdebug( 'Encountered an error: %s', error.message );\n\t\t\treturn done( error );\n\t\t}\n\t\tcount += 1;\n\t\tdebug( 'Processed %d of %d properties.', count, len );\n\t\tif ( idx < maxIndex ) {\n\t\t\treturn next();\n\t\t}\n\t\tif ( count === len ) {\n\t\t\tdebug( 'Finished processing an object.' );\n\t\t\treturn done( null, out );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default limit;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 format from '@stdlib/string-format';\nimport PINF from '@stdlib/constants-float64-pinf';\nimport validate from './validate.js';\nimport limit from './limit.js';\n\n\n// MAIN //\n\n/**\n* Returns a function to map keys from one object to a new object having the same values.\n*\n* ## Notes\n*\n* - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n* - Iteration and insertion order are **not** guaranteed.\n* - The function only operates on own properties, not inherited properties.\n*\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next own property\n* @param {Function} transform - transform function\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} last argument must be a function\n* @returns {Function} function which maps keys from one object to a new object having the same values\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function read( key, value, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( value, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, key+':unreadable' );\n* }\n* next( null, key+':readable' );\n* }\n* }\n*\n* var opts = {\n* 'series': true\n* };\n*\n* // Create a reusable function:\n* var mapKeysAsync = factory( opts, read );\n*\n* // Create a dictionary of file names:\n* var files = {\n* 'file1': './beep.js',\n* 'file2': './boop.js'\n* };\n*\n* // Define a callback which handles errors:\n* function done( error, out ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( out );\n* }\n*\n* // Process each file in `files`:\n* mapKeysAsync( files, done );\n*/\nfunction factory( options, transform ) {\n\tvar opts;\n\tvar err;\n\tvar f;\n\n\topts = {};\n\tif ( arguments.length > 1 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t\tf = transform;\n\t} else {\n\t\tf = options;\n\t}\n\tif ( !isFunction( f ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', f ) );\n\t}\n\tif ( opts.series ) {\n\t\topts.limit = 1;\n\t} else if ( !opts.limit ) {\n\t\topts.limit = PINF;\n\t}\n\treturn mapKeysAsync;\n\n\t/**\n\t* Maps keys from one object to a new object having the same values.\n\t*\n\t* @private\n\t* @param {Object} obj - source object\n\t* @param {Callback} done - function to invoke upon completion\n\t* @throws {TypeError} first argument must be an object\n\t* @throws {TypeError} last argument must be a function\n\t* @returns {void}\n\t*/\n\tfunction mapKeysAsync( obj, done ) {\n\t\tif ( typeof obj !== 'object' || obj === null ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be an object. Value: `%s`.', obj ) );\n\t\t}\n\t\tif ( !isFunction( done ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t\t}\n\t\treturn limit( obj, opts, f, clbk );\n\n\t\t/**\n\t\t* Callback invoked upon completion.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {Object} [out] - output object\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction clbk( error, out ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\tdone( null, out );\n\t\t}\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 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 isPositiveInteger } from '@stdlib/assert-is-positive-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 {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next own property\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'thisArg': {},\n* 'series': false,\n* 'limit': 10\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, 'thisArg' ) ) {\n\t\topts.thisArg = options.thisArg;\n\t}\n\tif ( hasOwnProp( options, 'series' ) ) {\n\t\topts.series = options.series;\n\t\tif ( !isBoolean( opts.series ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'series', opts.series ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'limit' ) ) {\n\t\topts.limit = options.limit;\n\t\tif ( !isPositiveInteger( opts.limit ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport factory from './factory.js';\n\n\n// MAIN //\n\n/**\n* Maps keys from one object to a new object having the same values.\n*\n* ## Notes\n*\n* - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n* - Iteration and insertion order are **not** guaranteed.\n* - The function only operates on own properties, not inherited properties.\n*\n* @param {Object} obj - source object\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next own property\n* @param {Function} transform - transform function\n* @param {Callback} done - function to invoke upon completion\n* @throws {TypeError} first argument must be an object\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} second-to-last argument must be a function\n* @throws {TypeError} last argument must be a function\n* @returns {void}\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function read( key, value, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( value, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, key+':unreadable' );\n* }\n* next( null, key+':readable' );\n* }\n* }\n*\n* // Define a callback which handles errors:\n* function done( error, out ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( out );\n* }\n*\n* // Create a dictionary of file names:\n* var files = {\n* 'file1': './beep.js',\n* 'file2': './boop.js'\n* };\n*\n* var opts = {\n* 'series': true\n* };\n*\n* // Process each file in `files`:\n* mapKeysAsync( files, opts, read, done );\n*/\nfunction mapKeysAsync( obj, options, transform, done ) {\n\tif ( arguments.length < 4 ) {\n\t\treturn factory( options )( obj, transform );\n\t}\n\tfactory( options, transform )( obj, done );\n}\n\n\n// EXPORTS //\n\nexport default mapKeysAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Map keys from one object to a new object having the same values.\n*\n* @module @stdlib/utils-async-map-keys\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n* import mapKeysAsync from '@stdlib/utils-async-map-keys';\n*\n* function read( key, value, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( value, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, key+':unreadable' );\n* }\n* next( null, key+':readable' );\n* }\n* }\n*\n* // Define a callback which handles errors:\n* function done( error, out ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( out );\n* }\n*\n* // Create a dictionary of file names:\n* var files = {\n* 'file1': './beep.js',\n* 'file2': './boop.js'\n* };\n*\n* var opts = {\n* 'series': true\n* };\n*\n* // Process each file in `files`:\n* mapKeysAsync( files, opts, read, done );\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport objectKeys from '@stdlib/utils-keys';\n\n\n// VARIABLES //\n\nvar debug = logger( 'map-values-async:limit' );\n\n\n// MAIN //\n\n/**\n* Invokes a function once for each own property in a source object, limiting the number of concurrently pending functions.\n*\n* @private\n* @param {Object} obj - source object\n* @param {Options} opts - function options\n* @param {*} [opts.thisArg] - execution context\n* @param {PositiveInteger} [opts.limit] - maximum number of pending function invocations\n* @param {Function} fcn - function to invoke\n* @param {Callback} done - function to invoke upon completion or upon encountering an error\n* @returns {void}\n*/\nfunction limit( obj, opts, fcn, done ) {\n\tvar maxIndex;\n\tvar count;\n\tvar keys;\n\tvar flg;\n\tvar lim;\n\tvar len;\n\tvar idx;\n\tvar out;\n\tvar i;\n\n\tkeys = objectKeys( obj );\n\tlen = keys.length;\n\tdebug( 'Number of keys: %d', len );\n\n\tout = {};\n\tif ( len === 0 ) {\n\t\tdebug( 'Finished processing an object.' );\n\t\treturn done( null, out );\n\t}\n\tif ( len < opts.limit ) {\n\t\tlim = len;\n\t} else {\n\t\tlim = opts.limit;\n\t}\n\tdebug( 'Concurrency limit: %d', lim );\n\tdebug( 'Number of arguments: %d', fcn.length );\n\n\tmaxIndex = len - 1;\n\tcount = 0;\n\tidx = -1;\n\tfor ( i = 0; i < lim; i++ ) {\n\t\t// This guard is necessary to protect against synchronous functions which exhaust all properties...\n\t\tif ( idx < maxIndex ) {\n\t\t\tnext(); // eslint-disable-line node/callback-return\n\t\t}\n\t}\n\t/**\n\t* Callback to invoke a provided function for the next property.\n\t*\n\t* @private\n\t*/\n\tfunction next() {\n\t\tvar key;\n\t\tidx += 1;\n\t\tkey = keys[ idx ];\n\t\tdebug( '%s: %s', key, JSON.stringify( obj[ key ] ) );\n\t\tif ( fcn.length === 2 ) {\n\t\t\tfcn.call( opts.thisArg, obj[ key ], cb );\n\t\t} else if ( fcn.length === 3 ) {\n\t\t\tfcn.call( opts.thisArg, obj[ key ], key, cb );\n\t\t} else {\n\t\t\tfcn.call( opts.thisArg, obj[ key ], key, obj, cb );\n\t\t}\n\t\t/**\n\t\t* Callback invoked once a provided function finishes transforming a property value.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {*} [value] - transformed value\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction cb( error, value ) {\n\t\t\tif ( flg ) {\n\t\t\t\t// Prevent further processing of properties:\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( error ) {\n\t\t\t\tflg = true;\n\t\t\t\treturn clbk( error );\n\t\t\t}\n\t\t\tdebug( 'Transform result => %s: %s', key, JSON.stringify( value ) );\n\t\t\tout[ key ] = value;\n\t\t\tclbk();\n\t\t}\n\t}\n\n\t/**\n\t* Callback invoked once ready to process the next property.\n\t*\n\t* @private\n\t* @param {*} [error] - error\n\t* @returns {void}\n\t*/\n\tfunction clbk( error ) {\n\t\tif ( error ) {\n\t\t\tdebug( 'Encountered an error: %s', error.message );\n\t\t\treturn done( error );\n\t\t}\n\t\tcount += 1;\n\t\tdebug( 'Processed %d of %d properties.', count, len );\n\t\tif ( idx < maxIndex ) {\n\t\t\treturn next();\n\t\t}\n\t\tif ( count === len ) {\n\t\t\tdebug( 'Finished processing an object.' );\n\t\t\treturn done( null, out );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default limit;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 format from '@stdlib/string-format';\nimport PINF from '@stdlib/constants-float64-pinf';\nimport validate from './validate.js';\nimport limit from './limit.js';\n\n\n// MAIN //\n\n/**\n* Returns a function to map values from one object to a new object having the same keys.\n*\n* ## Notes\n*\n* - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n* - Iteration and insertion order are **not** guaranteed.\n* - The function only operates on own properties, not inherited properties.\n*\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next own property\n* @param {Function} transform - transform function\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} last argument must be a function\n* @returns {Function} function which maps values from one object to a new object having the same keys\n*\n* @example\n* var stat = require( 'fs' ).stat;\n*\n* function getStats( file, next ) {\n* stat( file, onStats );\n*\n* function onStats( error, data ) {\n* if ( error ) {\n* return next( error );\n* }\n* next( null, data );\n* }\n* }\n*\n* var opts = {\n* 'series': true\n* };\n*\n* // Create a reusable function:\n* var mapValuesAsync = factory( opts, getStats );\n*\n* // Create a dictionary of file names:\n* var files = {\n* 'file1': './beep.js',\n* 'file2': './boop.js'\n* };\n*\n* // Define a callback which handles errors:\n* function done( error, out ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( out );\n* }\n*\n* // Process each file in `files`:\n* mapValuesAsync( files, done );\n*/\nfunction factory( options, transform ) {\n\tvar opts;\n\tvar err;\n\tvar f;\n\n\topts = {};\n\tif ( arguments.length > 1 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t\tf = transform;\n\t} else {\n\t\tf = options;\n\t}\n\tif ( !isFunction( f ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', f ) );\n\t}\n\tif ( opts.series ) {\n\t\topts.limit = 1;\n\t} else if ( !opts.limit ) {\n\t\topts.limit = PINF;\n\t}\n\treturn mapValuesAsync;\n\n\t/**\n\t* Maps values from one object to a new object having the same keys.\n\t*\n\t* @private\n\t* @param {Object} obj - source object\n\t* @param {Callback} done - function to invoke upon completion\n\t* @throws {TypeError} first argument must be an object\n\t* @throws {TypeError} last argument must be a function\n\t* @returns {void}\n\t*/\n\tfunction mapValuesAsync( obj, done ) {\n\t\tif ( typeof obj !== 'object' || obj === null ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be an object. Value: `%s`.', obj ) );\n\t\t}\n\t\tif ( !isFunction( done ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t\t}\n\t\treturn limit( obj, opts, f, clbk );\n\n\t\t/**\n\t\t* Callback invoked upon completion.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {Object} [out] - output object\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction clbk( error, out ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\tdone( null, out );\n\t\t}\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 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 isPositiveInteger } from '@stdlib/assert-is-positive-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 {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next own property\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'thisArg': {},\n* 'series': false,\n* 'limit': 10\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, 'thisArg' ) ) {\n\t\topts.thisArg = options.thisArg;\n\t}\n\tif ( hasOwnProp( options, 'series' ) ) {\n\t\topts.series = options.series;\n\t\tif ( !isBoolean( opts.series ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'series', opts.series ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'limit' ) ) {\n\t\topts.limit = options.limit;\n\t\tif ( !isPositiveInteger( opts.limit ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport factory from './factory.js';\n\n\n// MAIN //\n\n/**\n* Maps values from one object to a new object having the same keys.\n*\n* ## Notes\n*\n* - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n* - Iteration and insertion order are **not** guaranteed.\n* - The function only operates on own properties, not inherited properties.\n*\n* @param {Object} obj - source object\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next own property\n* @param {Function} transform - transform function\n* @param {Callback} done - function to invoke upon completion\n* @throws {TypeError} first argument must be an object\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} second-to-last argument must be a function\n* @throws {TypeError} last argument must be a function\n* @returns {void}\n*\n* @example\n* var stat = require( 'fs' ).stat;\n*\n* function getStats( file, next ) {\n* stat( file, onStats );\n*\n* function onStats( error, data ) {\n* if ( error ) {\n* return next( error );\n* }\n* next( null, data );\n* }\n* }\n*\n* // Define a callback which handles errors:\n* function done( error, out ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( out );\n* }\n*\n* // Create a dictionary of file names:\n* var files = {\n* 'file1': './beep.js',\n* 'file2': './boop.js'\n* };\n*\n* var opts = {\n* 'series': true\n* };\n*\n* // Process each file in `files`:\n* mapValuesAsync( files, opts, getStats, done );\n*/\nfunction mapValuesAsync( obj, options, transform, done ) {\n\tif ( arguments.length < 4 ) {\n\t\treturn factory( options )( obj, transform );\n\t}\n\tfactory( options, transform )( obj, done );\n}\n\n\n// EXPORTS //\n\nexport default mapValuesAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Map values from one object to a new object having the same keys.\n*\n* @module @stdlib/utils-async-map-values\n*\n* @example\n* var stat = require( 'fs' ).stat;\n* import mapValuesAsync from '@stdlib/utils-async-map-values';\n*\n* function getStats( file, next ) {\n* stat( file, onStats );\n*\n* function onStats( error, data ) {\n* if ( error ) {\n* return next( error );\n* }\n* next( null, data );\n* }\n* }\n*\n* // Define a callback which handles errors:\n* function done( error, out ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( out );\n* }\n*\n* // Create a dictionary of file names:\n* var files = {\n* 'file1': './beep.js',\n* 'file2': './boop.js'\n* };\n*\n* var opts = {\n* 'series': true\n* };\n*\n* // Process each file in `files`:\n* mapValuesAsync( files, opts, getStats, done );\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'none-by-async:limit' );\n\n\n// MAIN //\n\n/**\n* Invokes a predicate function once for each element in a collection, limiting the number of concurrently pending functions.\n*\n* @private\n* @param {Collection} collection - input collection\n* @param {Options} opts - function options\n* @param {*} [opts.thisArg] - execution context\n* @param {PositiveInteger} [opts.limit] - maximum number of pending function invocations\n* @param {Function} predicate - predicate function\n* @param {Callback} done - function to invoke upon completion or upon encountering an error\n* @returns {void}\n*/\nfunction limit( collection, opts, predicate, done ) {\n\tvar maxIndex;\n\tvar count;\n\tvar flg;\n\tvar lim;\n\tvar len;\n\tvar idx;\n\tvar i;\n\n\tlen = collection.length;\n\tdebug( 'Collection length: %d', len );\n\n\tif ( len === 0 ) {\n\t\tdebug( 'Finished processing a collection.' );\n\t\treturn done( null, true );\n\t}\n\tif ( len < opts.limit ) {\n\t\tlim = len;\n\t} else {\n\t\tlim = opts.limit;\n\t}\n\tdebug( 'Concurrency limit: %d', lim );\n\tdebug( 'Number of arguments: %d', predicate.length );\n\n\tmaxIndex = len - 1;\n\tcount = 0;\n\tidx = -1;\n\tfor ( i = 0; i < lim; i++ ) {\n\t\t// This guard is necessary to protect against synchronous functions which exhaust all collection elements...\n\t\tif ( idx < maxIndex ) {\n\t\t\tnext(); // eslint-disable-line node/callback-return\n\t\t}\n\t}\n\n\t/**\n\t* Callback to invoke a provided function for the next element in a collection.\n\t*\n\t* @private\n\t*/\n\tfunction next() {\n\t\tidx += 1;\n\t\tdebug( 'Collection element %d: %s.', idx, JSON.stringify( collection[ idx ] ) );\n\t\tif ( predicate.length === 2 ) {\n\t\t\tpredicate.call( opts.thisArg, collection[ idx ], clbk );\n\t\t} else if ( predicate.length === 3 ) {\n\t\t\tpredicate.call( opts.thisArg, collection[ idx ], idx, clbk );\n\t\t} else {\n\t\t\tpredicate.call( opts.thisArg, collection[ idx ], idx, collection, clbk ); // eslint-disable-line max-len\n\t\t}\n\t}\n\n\t/**\n\t* Callback invoked once a provided function finishes processing a collection element.\n\t*\n\t* @private\n\t* @param {*} [error] - error\n\t* @param {*} [result] - test result\n\t* @returns {void}\n\t*/\n\tfunction clbk( error, result ) {\n\t\tif ( flg ) {\n\t\t\t// Prevent further processing of collection elements:\n\t\t\treturn;\n\t\t}\n\t\tif ( error ) {\n\t\t\tflg = true;\n\t\t\tdebug( 'Encountered an error: %s', error.message );\n\t\t\treturn done( error );\n\t\t}\n\t\tcount += 1;\n\t\tdebug( 'Processed %d of %d collection elements.', count, len );\n\n\t\tdebug( 'Test result: %s', !!result );\n\t\tif ( result && !flg ) {\n\t\t\tflg = true;\n\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\treturn done( null, false );\n\t\t}\n\t\tif ( idx < maxIndex ) {\n\t\t\treturn next();\n\t\t}\n\t\tif ( count === len ) {\n\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\treturn done( null, true );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default limit;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isCollection from '@stdlib/assert-is-collection';\nimport format from '@stdlib/string-format';\nimport PINF from '@stdlib/constants-float64-pinf';\nimport validate from './validate.js';\nimport limit from './limit.js';\n\n\n// MAIN //\n\n/**\n* Returns a function for testing whether all elements in a collection fail a test implemented by a predicate function.\n*\n* ## Notes\n*\n* - If a predicate function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} predicate - predicate function to invoke for each element in a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} last argument must be a function\n* @returns {Function} function which invokes the predicate function once for each element in a collection\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* var opts = {\n* 'series': true\n* };\n*\n* // Create an `noneByAsync` function which invokes the predicate function for each collection element sequentially:\n* var noneByAsync = factory( opts, predicate );\n*\n* // Create a collection over which to iterate:\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* // Define a callback which handles results:\n* function done( error, bool ) {\n* if ( error ) {\n* throw error;\n* }\n* if ( bool ) {\n* console.log( 'Was unable to read all files.' );\n* } else {\n* console.log( 'Was able to read at least one file.' );\n* }\n* }\n*\n* // Try to read each element in `files`:\n* noneByAsync( files, done );\n*/\nfunction factory( options, predicate ) {\n\tvar opts;\n\tvar err;\n\tvar f;\n\n\topts = {};\n\tif ( arguments.length > 1 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t\tf = predicate;\n\t} else {\n\t\tf = options;\n\t}\n\tif ( !isFunction( f ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', f ) );\n\t}\n\tif ( opts.series ) {\n\t\topts.limit = 1;\n\t} else if ( !opts.limit ) {\n\t\topts.limit = PINF;\n\t}\n\treturn noneByAsync;\n\n\t/**\n\t* Invokes a predicate function for each element in a collection.\n\t*\n\t* @private\n\t* @param {Collection} collection - input collection\n\t* @param {Callback} done - function to invoke upon completion\n\t* @throws {TypeError} first argument must be a collection\n\t* @throws {TypeError} last argument must be a function\n\t* @returns {void}\n\t*/\n\tfunction noneByAsync( collection, done ) {\n\t\tif ( !isCollection( collection ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a collection. Value: `%s`.', collection ) );\n\t\t}\n\t\tif ( !isFunction( done ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t\t}\n\t\treturn limit( collection, opts, f, clbk );\n\n\t\t/**\n\t\t* Callback invoked upon completion.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {boolean} bool - test result\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction clbk( error, bool ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error, false );\n\t\t\t}\n\t\t\tdone( null, bool );\n\t\t}\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 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 isPositiveInteger } from '@stdlib/assert-is-positive-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 {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'thisArg': {},\n* 'series': false,\n* 'limit': 10\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, 'thisArg' ) ) {\n\t\topts.thisArg = options.thisArg;\n\t}\n\tif ( hasOwnProp( options, 'series' ) ) {\n\t\topts.series = options.series;\n\t\tif ( !isBoolean( opts.series ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'series', opts.series ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'limit' ) ) {\n\t\topts.limit = options.limit;\n\t\tif ( !isPositiveInteger( opts.limit ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport factory from './factory.js';\n\n\n// MAIN //\n\n/**\n* Tests whether all elements in a collection fail a test implemented by a predicate function.\n*\n* ## Notes\n*\n* - If a predicate function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Collection} collection - input collection\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} predicate - predicate function to invoke for each element in a collection\n* @param {Callback} done - function to invoke upon completion\n* @throws {TypeError} first argument must be a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} second-to-last argument must be a function\n* @throws {TypeError} last argument must be a function\n* @returns {void}\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function done( error, bool ) {\n* if ( error ) {\n* throw error;\n* }\n* if ( bool ) {\n* console.log( 'Was unable to read all files.' );\n* } else {\n* console.log( 'Was able to read at least one file.' );\n* }\n* }\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* noneByAsync( files, predicate, done );\n*/\nfunction noneByAsync( collection, options, predicate, done ) {\n\tif ( arguments.length < 4 ) {\n\t\treturn factory( options )( collection, predicate );\n\t}\n\tfactory( options, predicate )( collection, done );\n}\n\n\n// EXPORTS //\n\nexport default noneByAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\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 whether all elements in a collection fail a test implemented by a predicate function.\n*\n* @module @stdlib/utils-async-none-by\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n* import noneByAsync from '@stdlib/utils-async-none-by';\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* function done( error, bool ) {\n* if ( error ) {\n* throw error;\n* }\n* if ( bool ) {\n* console.log( 'Was unable to read all files.' );\n* } else {\n* console.log( 'Was able to read at least one file.' );\n* }\n* }\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* noneByAsync( files, predicate, done );\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'none-by-right-async:limit' );\n\n\n// MAIN //\n\n/**\n* Invokes a predicate function once for each element in a collection, limiting the number of concurrently pending functions, and iterating from right to left.\n*\n* @private\n* @param {Collection} collection - input collection\n* @param {Options} opts - function options\n* @param {*} [opts.thisArg] - execution context\n* @param {PositiveInteger} [opts.limit] - maximum number of pending function invocations\n* @param {Function} predicate - predicate function\n* @param {Callback} done - function to invoke upon completion or upon encountering an error\n* @returns {void}\n*/\nfunction limit( collection, opts, predicate, done ) {\n\tvar count;\n\tvar flg;\n\tvar lim;\n\tvar len;\n\tvar idx;\n\tvar i;\n\n\tlen = collection.length;\n\tdebug( 'Collection length: %d', len );\n\n\tif ( len === 0 ) {\n\t\tdebug( 'Finished processing a collection.' );\n\t\treturn done( null, true );\n\t}\n\tif ( len < opts.limit ) {\n\t\tlim = len;\n\t} else {\n\t\tlim = opts.limit;\n\t}\n\tdebug( 'Concurrency limit: %d', lim );\n\tdebug( 'Number of arguments: %d', predicate.length );\n\n\tcount = 0;\n\tidx = len;\n\tfor ( i = 0; i < lim; i++ ) {\n\t\t// This guard is necessary to protect against synchronous functions which exhaust all collection elements...\n\t\tif ( idx > 0 ) {\n\t\t\tnext(); // eslint-disable-line node/callback-return\n\t\t}\n\t}\n\n\t/**\n\t* Callback to invoke a provided function for the next element in a collection.\n\t*\n\t* @private\n\t*/\n\tfunction next() {\n\t\tidx -= 1;\n\t\tdebug( 'Collection element %d: %s.', idx, JSON.stringify( collection[ idx ] ) );\n\t\tif ( predicate.length === 2 ) {\n\t\t\tpredicate.call( opts.thisArg, collection[ idx ], clbk );\n\t\t} else if ( predicate.length === 3 ) {\n\t\t\tpredicate.call( opts.thisArg, collection[ idx ], idx, clbk );\n\t\t} else {\n\t\t\tpredicate.call( opts.thisArg, collection[ idx ], idx, collection, clbk ); // eslint-disable-line max-len\n\t\t}\n\t}\n\n\t/**\n\t* Callback invoked once a provided function finishes processing a collection element.\n\t*\n\t* @private\n\t* @param {*} [error] - error\n\t* @param {*} [result] - test result\n\t* @returns {void}\n\t*/\n\tfunction clbk( error, result ) {\n\t\tif ( flg ) {\n\t\t\t// Prevent further processing of collection elements:\n\t\t\treturn;\n\t\t}\n\t\tif ( error ) {\n\t\t\tflg = true;\n\t\t\tdebug( 'Encountered an error: %s', error.message );\n\t\t\treturn done( error );\n\t\t}\n\t\tcount += 1;\n\t\tdebug( 'Processed %d of %d collection elements.', count, len );\n\n\t\tdebug( 'Test result: %s', !!result );\n\t\tif ( result && !flg ) {\n\t\t\tflg = true;\n\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\treturn done( null, false );\n\t\t}\n\t\tif ( idx > 0 ) {\n\t\t\treturn next();\n\t\t}\n\t\tif ( count === len ) {\n\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\treturn done( null, true );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default limit;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isCollection from '@stdlib/assert-is-collection';\nimport format from '@stdlib/string-format';\nimport PINF from '@stdlib/constants-float64-pinf';\nimport validate from './validate.js';\nimport limit from './limit.js';\n\n\n// MAIN //\n\n/**\n* Returns a function for testing whether all elements in a collection fail a test implemented by a predicate function, iterating from right to left.\n*\n* ## Notes\n*\n* - If a predicate function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} predicate - predicate function to invoke for each element in a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} last argument must be a function\n* @returns {Function} function which invokes the predicate function once for each element in a collection\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* var opts = {\n* 'series': true\n* };\n*\n* // Create an `noneByRightAsync` function which invokes the predicate function for each collection element sequentially:\n* var noneByRightAsync = factory( opts, predicate );\n*\n* // Create a collection over which to iterate:\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* // Define a callback which handles results:\n* function done( error, bool ) {\n* if ( error ) {\n* throw error;\n* }\n* if ( bool ) {\n* console.log( 'Was unable to read all files.' );\n* } else {\n* console.log( 'Was able to read at least one file.' );\n* }\n* }\n*\n* // Try to read each element in `files`:\n* noneByRightAsync( files, done );\n*/\nfunction factory( options, predicate ) {\n\tvar opts;\n\tvar err;\n\tvar f;\n\n\topts = {};\n\tif ( arguments.length > 1 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t\tf = predicate;\n\t} else {\n\t\tf = options;\n\t}\n\tif ( !isFunction( f ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', f ) );\n\t}\n\tif ( opts.series ) {\n\t\topts.limit = 1;\n\t} else if ( !opts.limit ) {\n\t\topts.limit = PINF;\n\t}\n\treturn noneByRightAsync;\n\n\t/**\n\t* Invokes a predicate function for each element in a collection, iterating from right to left.\n\t*\n\t* @private\n\t* @param {Collection} collection - input collection\n\t* @param {Callback} done - function to invoke upon completion\n\t* @throws {TypeError} first argument must be a collection\n\t* @throws {TypeError} last argument must be a function\n\t* @returns {void}\n\t*/\n\tfunction noneByRightAsync( collection, done ) {\n\t\tif ( !isCollection( collection ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a collection. Value: `%s`.', collection ) );\n\t\t}\n\t\tif ( !isFunction( done ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t\t}\n\t\treturn limit( collection, opts, f, clbk );\n\n\t\t/**\n\t\t* Callback invoked upon completion.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {boolean} bool - test result\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction clbk( error, bool ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error, false );\n\t\t\t}\n\t\t\tdone( null, bool );\n\t\t}\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 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 isPositiveInteger } from '@stdlib/assert-is-positive-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 {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'thisArg': {},\n* 'series': false,\n* 'limit': 10\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, 'thisArg' ) ) {\n\t\topts.thisArg = options.thisArg;\n\t}\n\tif ( hasOwnProp( options, 'series' ) ) {\n\t\topts.series = options.series;\n\t\tif ( !isBoolean( opts.series ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'series', opts.series ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'limit' ) ) {\n\t\topts.limit = options.limit;\n\t\tif ( !isPositiveInteger( opts.limit ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport factory from './factory.js';\n\n\n// MAIN //\n\n/**\n* Tests whether all elements in a collection fail a test implemented by a predicate function, iterating from right to left.\n*\n* ## Notes\n*\n* - If a predicate function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Collection} collection - input collection\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} predicate - predicate function to invoke for each element in a collection\n* @param {Callback} done - function to invoke upon completion\n* @throws {TypeError} first argument must be a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} second-to-last argument must be a function\n* @throws {TypeError} last argument must be a function\n* @returns {void}\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function done( error, bool ) {\n* if ( error ) {\n* throw error;\n* }\n* if ( bool ) {\n* console.log( 'Was unable to read all files.' );\n* } else {\n* console.log( 'Was able to read at least one file.' );\n* }\n* }\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* noneByRightAsync( files, predicate, done );\n*/\nfunction noneByRightAsync( collection, options, predicate, done ) {\n\tif ( arguments.length < 4 ) {\n\t\treturn factory( options )( collection, predicate );\n\t}\n\tfactory( options, predicate )( collection, done );\n}\n\n\n// EXPORTS //\n\nexport default noneByRightAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\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 whether all elements in a collection fail a test implemented by a predicate function, iterating from right to left.\n*\n* @module @stdlib/utils-async-none-by-right\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n* import noneByRightAsync from '@stdlib/utils-async-none-by-right';\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* function done( error, bool ) {\n* if ( error ) {\n* throw error;\n* }\n* if ( bool ) {\n* console.log( 'Was unable to read all files.' );\n* } else {\n* console.log( 'Was able to read at least one file.' );\n* }\n* }\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* noneByRightAsync( files, predicate, done );\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'reduce-async:limit' );\n\n\n// MAIN //\n\n/**\n* Invokes a function once for each element in a collection, limiting the number of concurrently pending functions.\n*\n* @private\n* @param {Collection} collection - input collection\n* @param {*} acc - initial value\n* @param {Options} opts - function options\n* @param {*} [opts.thisArg] - execution context\n* @param {PositiveInteger} [opts.limit] - maximum number of pending function invocations\n* @param {Function} fcn - function to invoke\n* @param {Callback} done - function to invoke upon completion or upon encountering an error\n* @returns {void}\n*/\nfunction limit( collection, acc, opts, fcn, done ) {\n\tvar maxIndex;\n\tvar count;\n\tvar flg;\n\tvar lim;\n\tvar len;\n\tvar idx;\n\tvar i;\n\n\tlen = collection.length;\n\tdebug( 'Collection length: %d', len );\n\n\tif ( len === 0 ) {\n\t\tdebug( 'Finished processing a collection.' );\n\t\treturn done( null, acc );\n\t}\n\tif ( len < opts.limit ) {\n\t\tlim = len;\n\t} else {\n\t\tlim = opts.limit;\n\t}\n\tdebug( 'Concurrency limit: %d', lim );\n\tdebug( 'Number of arguments: %d', fcn.length );\n\n\tmaxIndex = len - 1;\n\tcount = 0;\n\tidx = -1;\n\tfor ( i = 0; i < lim; i++ ) {\n\t\t// This guard is necessary to protect against synchronous functions which exhaust all collection elements...\n\t\tif ( idx < maxIndex ) {\n\t\t\tnext(); // eslint-disable-line node/callback-return\n\t\t}\n\t}\n\t/**\n\t* Callback to invoke a provided function for the next element in a collection.\n\t*\n\t* @private\n\t*/\n\tfunction next() {\n\t\tidx += 1;\n\t\tdebug( 'Collection element %d: %s.', idx, JSON.stringify( collection[ idx ] ) );\n\t\tif ( fcn.length === 3 ) {\n\t\t\tfcn.call( opts.thisArg, acc, collection[ idx ], cb );\n\t\t} else if ( fcn.length === 4 ) {\n\t\t\tfcn.call( opts.thisArg, acc, collection[ idx ], idx, cb );\n\t\t} else {\n\t\t\tfcn.call( opts.thisArg, acc, collection[ idx ], idx, collection, cb ); // eslint-disable-line max-len\n\t\t}\n\t\t/**\n\t\t* Callback invoked once a provided function finishes processing a collection element.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {*} [result] - accumulation result\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction cb( error, result ) {\n\t\t\tif ( flg ) {\n\t\t\t\t// Prevent further processing of collection elements:\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( error ) {\n\t\t\t\tflg = true;\n\t\t\t\treturn clbk( error );\n\t\t\t}\n\t\t\tdebug( 'Accumulator: %s', JSON.stringify( result ) );\n\t\t\tacc = result;\n\t\t\tclbk();\n\t\t}\n\t}\n\n\t/**\n\t* Callback invoked once ready to process the next collection element.\n\t*\n\t* @private\n\t* @param {*} [error] - error\n\t* @returns {void}\n\t*/\n\tfunction clbk( error ) {\n\t\tif ( error ) {\n\t\t\tdebug( 'Encountered an error: %s', error.message );\n\t\t\treturn done( error );\n\t\t}\n\t\tcount += 1;\n\t\tdebug( 'Processed %d of %d collection elements.', count, len );\n\t\tif ( idx < maxIndex ) {\n\t\t\treturn next();\n\t\t}\n\t\tif ( count === len ) {\n\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\treturn done( null, acc );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default limit;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isCollection from '@stdlib/assert-is-collection';\nimport format from '@stdlib/string-format';\nimport PINF from '@stdlib/constants-float64-pinf';\nimport validate from './validate.js';\nimport limit from './limit.js';\n\n\n// MAIN //\n\n/**\n* Returns a function to apply a function against an accumulator and each element in a collection and return the accumulated result.\n*\n* ## Notes\n*\n* - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=true] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} fcn - function to invoke for each element in a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} last argument must be a function\n* @returns {Function} function which invokes the provided function once for each element in a collection\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function read( acc, file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error, data ) {\n* if ( error ) {\n* return next( null, acc );\n* }\n* acc.count += 1;\n* next( null, acc );\n* }\n* }\n*\n* var opts = {\n* 'series': false\n* };\n*\n* // Create a `reduceAsync` function which invokes `read` for each collection element concurrently:\n* var reduceAsync = factory( opts, read );\n*\n* // Create a collection over which to iterate:\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* // Define a callback which handles errors:\n* function done( error, acc ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( acc.count );\n* }\n*\n* // Run `read` for each element in `files`:\n* var acc = {\n* 'count': 0\n* };\n* reduceAsync( files, acc, done );\n*/\nfunction factory( options, fcn ) {\n\tvar opts;\n\tvar err;\n\tvar f;\n\n\topts = {};\n\tif ( arguments.length > 1 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t\tf = fcn;\n\t} else {\n\t\tf = options;\n\t}\n\tif ( !isFunction( f ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', f ) );\n\t}\n\tif ( opts.series === void 0 && opts.limit === void 0 ) {\n\t\topts.series = true;\n\t}\n\tif ( opts.series ) {\n\t\topts.limit = 1;\n\t} else if ( !opts.limit ) {\n\t\topts.limit = PINF;\n\t}\n\treturn reduceAsync;\n\n\t/**\n\t* Applies a function against an accumulator and each element in a collection and return the accumulated result.\n\t*\n\t* @private\n\t* @param {Collection} collection - input collection\n\t* @param {*} initial - initial value\n\t* @param {Callback} done - function to invoke upon completion\n\t* @throws {TypeError} first argument must be a collection\n\t* @throws {TypeError} last argument must be a function\n\t* @returns {void}\n\t*/\n\tfunction reduceAsync( collection, initial, done ) {\n\t\tif ( !isCollection( collection ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a collection. Value: `%s`.', collection ) );\n\t\t}\n\t\tif ( !isFunction( done ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t\t}\n\t\treturn limit( collection, initial, opts, f, clbk );\n\n\t\t/**\n\t\t* Callback invoked upon completion.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {*} [acc] - accumulated value\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction clbk( error, acc ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\tdone( null, acc );\n\t\t}\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 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 isPositiveInteger } from '@stdlib/assert-is-positive-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 {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'thisArg': {},\n* 'series': false,\n* 'limit': 10\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, 'thisArg' ) ) {\n\t\topts.thisArg = options.thisArg;\n\t}\n\tif ( hasOwnProp( options, 'series' ) ) {\n\t\topts.series = options.series;\n\t\tif ( !isBoolean( opts.series ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'series', opts.series ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'limit' ) ) {\n\t\topts.limit = options.limit;\n\t\tif ( !isPositiveInteger( opts.limit ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport factory from './factory.js';\n\n\n// MAIN //\n\n/**\n* Applies a function against an accumulator and each element in a collection and return the accumulated result.\n*\n* ## Notes\n*\n* - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Collection} collection - input collection\n* @param {*} initial - initial value\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=true] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} fcn - function to invoke for each element in a collection\n* @param {Callback} done - function to invoke upon completion\n* @throws {TypeError} first argument must be a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} second-to-last argument must be a function\n* @throws {TypeError} last argument must be a function\n* @returns {void}\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function done( error, acc ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( acc.count );\n* }\n*\n* function read( acc, file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, acc );\n* }\n* acc.count += 1;\n* next( null, acc );\n* }\n* }\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n* var acc = {\n* 'count': 0\n* };\n* reduceAsync( files, acc, read, done );\n*/\nfunction reduceAsync( collection, initial, options, fcn, done ) {\n\tif ( arguments.length < 5 ) {\n\t\treturn factory( options )( collection, initial, fcn );\n\t}\n\tfactory( options, fcn )( collection, initial, done );\n}\n\n\n// EXPORTS //\n\nexport default reduceAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Apply a function against an accumulator and each element in a collection and return the accumulated result.\n*\n* @module @stdlib/utils-async-reduce\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n* import reduceAsync from '@stdlib/utils-async-reduce';\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* function done( error, acc ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( acc.count );\n* }\n*\n* function read( acc, file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, acc );\n* }\n* acc.count += 1;\n* next( null, acc );\n* }\n* }\n*\n* var acc = {\n* 'count': 0\n* };\n* reduceAsync( files, acc, read, done );\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'reduce-right-async:limit' );\n\n\n// MAIN //\n\n/**\n* Invokes a function once for each element in a collection, limiting the number of concurrently pending functions and iterating from right to left.\n*\n* @private\n* @param {Collection} collection - input collection\n* @param {*} acc - initial value\n* @param {Options} opts - function options\n* @param {*} [opts.thisArg] - execution context\n* @param {PositiveInteger} [opts.limit] - maximum number of pending function invocations\n* @param {Function} fcn - function to invoke\n* @param {Callback} done - function to invoke upon completion or upon encountering an error\n* @returns {void}\n*/\nfunction limit( collection, acc, opts, fcn, done ) {\n\tvar count;\n\tvar flg;\n\tvar lim;\n\tvar len;\n\tvar idx;\n\tvar i;\n\n\tlen = collection.length;\n\tdebug( 'Collection length: %d', len );\n\n\tif ( len === 0 ) {\n\t\tdebug( 'Finished processing a collection.' );\n\t\treturn done( null, acc );\n\t}\n\tif ( len < opts.limit ) {\n\t\tlim = len;\n\t} else {\n\t\tlim = opts.limit;\n\t}\n\tdebug( 'Concurrency limit: %d', lim );\n\tdebug( 'Number of arguments: %d', fcn.length );\n\n\tcount = 0;\n\tidx = len;\n\tfor ( i = 0; i < lim; i++ ) {\n\t\t// This guard is necessary to protect against synchronous functions which exhaust all collection elements...\n\t\tif ( idx > 0 ) {\n\t\t\tnext(); // eslint-disable-line node/callback-return\n\t\t}\n\t}\n\t/**\n\t* Callback to invoke a provided function for the next element in a collection.\n\t*\n\t* @private\n\t*/\n\tfunction next() {\n\t\tidx -= 1;\n\t\tdebug( 'Collection element %d: %s.', idx, JSON.stringify( collection[ idx ] ) );\n\t\tif ( fcn.length === 3 ) {\n\t\t\tfcn.call( opts.thisArg, acc, collection[ idx ], cb );\n\t\t} else if ( fcn.length === 4 ) {\n\t\t\tfcn.call( opts.thisArg, acc, collection[ idx ], idx, cb );\n\t\t} else {\n\t\t\tfcn.call( opts.thisArg, acc, collection[ idx ], idx, collection, cb ); // eslint-disable-line max-len\n\t\t}\n\t\t/**\n\t\t* Callback invoked once a provided function finishes processing a collection element.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {*} [result] - accumulation result\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction cb( error, result ) {\n\t\t\tif ( flg ) {\n\t\t\t\t// Prevent further processing of collection elements:\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( error ) {\n\t\t\t\tflg = true;\n\t\t\t\treturn clbk( error );\n\t\t\t}\n\t\t\tdebug( 'Accumulator: %s', JSON.stringify( result ) );\n\t\t\tacc = result;\n\t\t\tclbk();\n\t\t}\n\t}\n\n\t/**\n\t* Callback invoked once ready to process the next collection element.\n\t*\n\t* @private\n\t* @param {*} [error] - error\n\t* @returns {void}\n\t*/\n\tfunction clbk( error ) {\n\t\tif ( error ) {\n\t\t\tdebug( 'Encountered an error: %s', error.message );\n\t\t\treturn done( error );\n\t\t}\n\t\tcount += 1;\n\t\tdebug( 'Processed %d of %d collection elements.', count, len );\n\t\tif ( idx > 0 ) {\n\t\t\treturn next();\n\t\t}\n\t\tif ( count === len ) {\n\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\treturn done( null, acc );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default limit;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isCollection from '@stdlib/assert-is-collection';\nimport format from '@stdlib/string-format';\nimport PINF from '@stdlib/constants-float64-pinf';\nimport validate from './validate.js';\nimport limit from './limit.js';\n\n\n// MAIN //\n\n/**\n* Returns a function to apply a function against an accumulator and each element in a collection and return the accumulated result, iterating from right to left.\n*\n* ## Notes\n*\n* - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=true] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} fcn - function to invoke for each element in a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} last argument must be a function\n* @returns {Function} function which invokes the provided function once for each element in a collection\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function read( acc, file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error, data ) {\n* if ( error ) {\n* return next( null, acc );\n* }\n* acc.count += 1;\n* next( null, acc );\n* }\n* }\n*\n* var opts = {\n* 'series': false\n* };\n*\n* // Create a `reduceRightAsync` function which invokes `read` for each collection element concurrently:\n* var reduceRightAsync = factory( opts, read );\n*\n* // Create a collection over which to iterate:\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* // Define a callback which handles errors:\n* function done( error, acc ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( acc.count );\n* }\n*\n* // Run `read` for each element in `files`:\n* var acc = {\n* 'count': 0\n* };\n* reduceRightAsync( files, acc, done );\n*/\nfunction factory( options, fcn ) {\n\tvar opts;\n\tvar err;\n\tvar f;\n\n\topts = {};\n\tif ( arguments.length > 1 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t\tf = fcn;\n\t} else {\n\t\tf = options;\n\t}\n\tif ( !isFunction( f ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', f ) );\n\t}\n\tif ( opts.series === void 0 && opts.limit === void 0 ) {\n\t\topts.series = true;\n\t}\n\tif ( opts.series ) {\n\t\topts.limit = 1;\n\t} else if ( !opts.limit ) {\n\t\topts.limit = PINF;\n\t}\n\treturn reduceRightAsync;\n\n\t/**\n\t* Applies a function against an accumulator and each element in a collection and return the accumulated result, iterating from right to left.\n\t*\n\t* @private\n\t* @param {Collection} collection - input collection\n\t* @param {*} initial - initial value\n\t* @param {Callback} done - function to invoke upon completion\n\t* @throws {TypeError} first argument must be a collection\n\t* @throws {TypeError} last argument must be a function\n\t* @returns {void}\n\t*/\n\tfunction reduceRightAsync( collection, initial, done ) {\n\t\tif ( !isCollection( collection ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a collection. Value: `%s`.', collection ) );\n\t\t}\n\t\tif ( !isFunction( done ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t\t}\n\t\treturn limit( collection, initial, opts, f, clbk );\n\n\t\t/**\n\t\t* Callback invoked upon completion.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {*} [acc] - accumulated value\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction clbk( error, acc ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\tdone( null, acc );\n\t\t}\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 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 isPositiveInteger } from '@stdlib/assert-is-positive-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 {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'thisArg': {},\n* 'series': false,\n* 'limit': 10\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, 'thisArg' ) ) {\n\t\topts.thisArg = options.thisArg;\n\t}\n\tif ( hasOwnProp( options, 'series' ) ) {\n\t\topts.series = options.series;\n\t\tif ( !isBoolean( opts.series ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'series', opts.series ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'limit' ) ) {\n\t\topts.limit = options.limit;\n\t\tif ( !isPositiveInteger( opts.limit ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport factory from './factory.js';\n\n\n// MAIN //\n\n/**\n* Applies a function against an accumulator and each element in a collection and return the accumulated result, iterating from right to left.\n*\n* ## Notes\n*\n* - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Collection} collection - input collection\n* @param {*} initial - initial value\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=true] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} fcn - function to invoke for each element in a collection\n* @param {Callback} done - function to invoke upon completion\n* @throws {TypeError} first argument must be a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} second-to-last argument must be a function\n* @throws {TypeError} last argument must be a function\n* @returns {void}\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function done( error, acc ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( acc.count );\n* }\n*\n* function read( acc, file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, acc );\n* }\n* acc.count += 1;\n* next( null, acc );\n* }\n* }\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n* var acc = {\n* 'count': 0\n* };\n* reduceRightAsync( files, acc, read, done );\n*/\nfunction reduceRightAsync( collection, initial, options, fcn, done ) {\n\tif ( arguments.length < 5 ) {\n\t\treturn factory( options )( collection, initial, fcn );\n\t}\n\tfactory( options, fcn )( collection, initial, done );\n}\n\n\n// EXPORTS //\n\nexport default reduceRightAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Apply a function against an accumulator and each element in a collection and return the accumulated result, iterating from right to left.\n*\n* @module @stdlib/utils-async-reduce-right\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n* import reduceRightAsync from '@stdlib/utils-async-reduce-right';\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* function done( error, acc ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( acc.count );\n* }\n*\n* function read( acc, file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, acc );\n* }\n* acc.count += 1;\n* next( null, acc );\n* }\n* }\n*\n* var acc = {\n* 'count': 0\n* };\n* reduceRightAsync( files, acc, read, done );\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Maximum length of a generic array.\n*\n* @module @stdlib/constants-array-max-array-length\n*\n* @example\n* import MAX_ARRAY_LENGTH from '@stdlib/constants-array-max-array-length';\n* // returns 4294967295\n*/\n\n// MAIN //\n\n/**\n* Maximum length of a generic array.\n*\n* ```tex\n* 2^{32} - 1\n* ```\n*\n* @constant\n* @type {uinteger32}\n* @default 4294967295\n*/\nvar MAX_ARRAY_LENGTH = 4294967295>>>0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default MAX_ARRAY_LENGTH;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Test if a value is an array-like object containing only functions.\n*\n* @module @stdlib/assert-is-function-array\n*\n* @example\n* import isFunctionArray from '@stdlib/assert-is-function-array';\n*\n* function beep() {}\n*\n* function boop() {}\n*\n* var bool = isFunctionArray( [ beep, boop ] );\n* // returns true\n*\n* bool = isFunctionArray( [ {}, beep ] );\n* // returns false\n*\n* bool = isFunctionArray( [] );\n* // returns false\n*/\n\n// MODULES //\n\nimport arrayfun from '@stdlib/assert-tools-array-like-function';\nimport isFunction from '@stdlib/assert-is-function';\n\n\n// MAIN //\n\nvar isFunctionArray = arrayfun( isFunction );\n\n\n// EXPORTS //\n\nexport default isFunctionArray;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isArrayLike from '@stdlib/assert-is-array-like';\nimport format from '@stdlib/string-format';\n\n\n// MAIN //\n\n/**\n* Returns a function which tests if every element in an array-like object passes a test condition.\n*\n* @param {Function} predicate - function to apply\n* @throws {TypeError} must provide a function\n* @returns {Function} an array-like object 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 = arraylikefcn( isOdd );\n*\n* var bool = validate( arr1 );\n* // returns true\n*\n* bool = validate( arr2 );\n* // returns false\n*/\nfunction arraylikefcn( 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-like object 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-like object 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 ( !isArrayLike( 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 arraylikefcn;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isInteger from '@stdlib/math-base-assert-is-integer';\nimport MAX_LENGTH from '@stdlib/constants-array-max-array-length';\n\n\n// MAIN //\n\n/**\n* Tests if a value is array-like.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is array-like\n*\n* @example\n* var bool = isArrayLike( [] );\n* // returns true\n*\n* @example\n* var bool = isArrayLike( {'length':10} );\n* // returns true\n*/\nfunction isArrayLike( value ) {\n\treturn (\n\t\tvalue !== void 0 &&\n\t\tvalue !== null &&\n\t\ttypeof value !== 'function' &&\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 isArrayLike;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isFunctionArray from '@stdlib/assert-is-function-array';\nimport isFunction from '@stdlib/assert-is-function';\nimport format from '@stdlib/string-format';\n\n\n// MAIN //\n\n/**\n* Returns a reusable waterfall function.\n*\n* @param {FunctionArray} fcns - array of functions\n* @param {Callback} clbk - callback to invoke upon completion\n* @param {*} [thisArg] - function context\n* @throws {TypeError} first argument must be an array of functions\n* @throws {TypeError} second argument must be a function\n* @returns {Function} waterfall function\n*\n* @example\n* function foo( next ) {\n* next( null, 'beep' );\n* }\n*\n* function bar( str, next ) {\n* console.log( str );\n* // => 'beep'\n*\n* next();\n* }\n*\n* function done( error ) {\n* if ( error ) {\n* throw error;\n* }\n* }\n*\n* var fcns = [ foo, bar ];\n*\n* var waterfall = factory( fcns, done );\n*\n* waterfall();\n* waterfall();\n* waterfall();\n*/\nfunction factory( fcns, clbk, thisArg ) {\n\tif ( !isFunctionArray( fcns ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an array of functions. Value: `%s`.', fcns ) );\n\t}\n\tif ( !isFunction( clbk ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a function. Value: `%s`.', clbk ) );\n\t}\n\treturn waterfall;\n\n\t/**\n\t* Executes functions in series, passing the results of one function as arguments to the next function.\n\t*\n\t* @private\n\t*/\n\tfunction waterfall() {\n\t\tvar idx = -1;\n\t\tnext(); // eslint-disable-line node/callback-return\n\n\t\t/**\n\t\t* Executes the next function in the series.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {...*} args - results to pass to next callback\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next() {\n\t\t\tvar args;\n\t\t\tvar len;\n\t\t\tvar i;\n\n\t\t\t// Check for an error...\n\t\t\tif ( arguments[ 0 ] ) {\n\t\t\t\treturn clbk( arguments[ 0 ] );\n\t\t\t}\n\t\t\t// Update the counter and check if we have run all functions...\n\t\t\tidx += 1;\n\t\t\tif ( idx >= fcns.length ) {\n\t\t\t\treturn clbk();\n\t\t\t}\n\t\t\t// Copy the remaining arguments...\n\t\t\tlen = arguments.length;\n\t\t\targs = new Array( len );\n\t\t\tfor ( i = 0; i < len-1; i++ ) {\n\t\t\t\targs[ i ] = arguments[ i+1 ];\n\t\t\t}\n\t\t\t// Add the callback:\n\t\t\targs[ i ] = next;\n\n\t\t\t// Apply the arguments to the next function in the waterfall:\n\t\t\tfcns[ idx ].apply( thisArg, args );\n\t\t}\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 factory from './factory.js';\n\n\n// MAIN //\n\n/**\n* Executes functions in series, passing the results of one function as arguments to the next function.\n*\n* @param {FunctionArray} fcns - array of functions\n* @param {Callback} clbk - callback to invoke upon completion\n* @param {*} [thisArg] - function context\n* @throws {TypeError} first argument must be an array of functions\n* @throws {TypeError} second argument must be a function\n*\n* @example\n* function foo( next ) {\n* next( null, 'beep' );\n* }\n*\n* function bar( str, next ) {\n* console.log( str );\n* // => 'beep'\n*\n* next();\n* }\n*\n* function done( error ) {\n* if ( error ) {\n* throw error;\n* }\n* }\n*\n* var fcns = [ foo, bar ];\n*\n* waterfall( fcns, done );\n*/\nfunction waterfall( fcns, clbk, thisArg ) {\n\tfactory( fcns, clbk, thisArg )();\n}\n\n\n// EXPORTS //\n\nexport default waterfall;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Execute functions in series, passing the results of one function as arguments to the next function.\n*\n* @module @stdlib/utils-async-series-waterfall\n*\n* @example\n* import waterfall from '@stdlib/utils-async-series-waterfall';\n*\n* function foo( next ) {\n* next( null, 'beep' );\n* }\n*\n* function bar( str, next ) {\n* console.log( str );\n* // => 'beep'\n*\n* next();\n* }\n*\n* function done( error ) {\n* if ( error ) {\n* throw error;\n* }\n* }\n*\n* var fcns = [ foo, bar ];\n*\n* waterfall( fcns, done );\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'some-by-async:limit' );\n\n\n// MAIN //\n\n/**\n* Invokes a predicate function once for each element in a collection, limiting the number of concurrently pending functions.\n*\n* @private\n* @param {Collection} collection - input collection\n* @param {PositiveInteger} n - number of elements\n* @param {Options} opts - function options\n* @param {*} [opts.thisArg] - execution context\n* @param {PositiveInteger} [opts.limit] - maximum number of pending function invocations\n* @param {Function} predicate - predicate function\n* @param {Callback} done - function to invoke upon completion or upon encountering an error\n* @returns {void}\n*/\nfunction limit( collection, n, opts, predicate, done ) {\n\tvar maxIndex;\n\tvar count;\n\tvar flg;\n\tvar lim;\n\tvar len;\n\tvar idx;\n\tvar cnt;\n\tvar i;\n\n\tlen = collection.length;\n\tdebug( 'Collection length: %d', len );\n\n\tif ( len === 0 ) {\n\t\tdebug( 'Finished processing a collection.' );\n\t\treturn done( null, false );\n\t}\n\tif ( len < opts.limit ) {\n\t\tlim = len;\n\t} else {\n\t\tlim = opts.limit;\n\t}\n\tdebug( 'Concurrency limit: %d', lim );\n\tdebug( 'Number of arguments: %d', predicate.length );\n\n\tmaxIndex = len - 1;\n\tcount = 0; // processed element count\n\tidx = -1;\n\tcnt = 0; // success count\n\tfor ( i = 0; i < lim; i++ ) {\n\t\t// This guard is necessary to protect against synchronous functions which exhaust all collection elements...\n\t\tif ( idx < maxIndex ) {\n\t\t\tnext(); // eslint-disable-line node/callback-return\n\t\t}\n\t}\n\n\t/**\n\t* Callback to invoke a provided function for the next element in a collection.\n\t*\n\t* @private\n\t*/\n\tfunction next() {\n\t\tidx += 1;\n\t\tdebug( 'Collection element %d: %s.', idx, JSON.stringify( collection[ idx ] ) );\n\t\tif ( predicate.length === 2 ) {\n\t\t\tpredicate.call( opts.thisArg, collection[ idx ], clbk );\n\t\t} else if ( predicate.length === 3 ) {\n\t\t\tpredicate.call( opts.thisArg, collection[ idx ], idx, clbk );\n\t\t} else {\n\t\t\tpredicate.call( opts.thisArg, collection[ idx ], idx, collection, clbk ); // eslint-disable-line max-len\n\t\t}\n\t}\n\n\t/**\n\t* Callback invoked once a provided function finishes processing a collection element.\n\t*\n\t* @private\n\t* @param {*} [error] - error\n\t* @param {*} [result] - test result\n\t* @returns {void}\n\t*/\n\tfunction clbk( error, result ) {\n\t\tif ( flg ) {\n\t\t\t// Prevent further processing of collection elements:\n\t\t\treturn;\n\t\t}\n\t\tif ( error ) {\n\t\t\tflg = true;\n\t\t\tdebug( 'Encountered an error: %s', error.message );\n\t\t\treturn done( error );\n\t\t}\n\t\tcount += 1;\n\t\tdebug( 'Processed %d of %d collection elements.', count, len );\n\n\t\tdebug( 'Test result: %s', !!result );\n\t\tif ( result && !flg ) {\n\t\t\tcnt += 1;\n\t\t\tif ( cnt === n ) {\n\t\t\t\tflg = true;\n\t\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\t\treturn done( null, true );\n\t\t\t}\n\t\t}\n\t\tif ( idx < maxIndex ) {\n\t\t\treturn next();\n\t\t}\n\t\tif ( count === len ) {\n\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\treturn done( null, false );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default limit;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isCollection from '@stdlib/assert-is-collection';\nimport { isPrimitive as isPositiveInteger } from '@stdlib/assert-is-positive-integer';\nimport format from '@stdlib/string-format';\nimport PINF from '@stdlib/constants-float64-pinf';\nimport validate from './validate.js';\nimport limit from './limit.js';\n\n\n// MAIN //\n\n/**\n* Returns a function for testing whether a collection contains at least `n` elements which pass a test implemented by a predicate function.\n*\n* ## Notes\n*\n* - If a predicate function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} predicate - predicate function to invoke for each element in a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} last argument must be a function\n* @returns {Function} function which invokes the predicate function once for each element in a collection\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* var opts = {\n* 'series': true\n* };\n*\n* // Create a `someByAsync` function which invokes the predicate function for each collection element sequentially:\n* var someByAsync = factory( opts, predicate );\n*\n* // Create a collection over which to iterate:\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* // Define a callback which handles results:\n* function done( error, bool ) {\n* if ( error ) {\n* throw error;\n* }\n* if ( bool ) {\n* console.log( 'Successfully read some files.' );\n* } else {\n* console.log( 'Unable to read some files.' );\n* }\n* }\n*\n* // Try to read each element in `files`:\n* someByAsync( files, 2, done );\n*/\nfunction factory( options, predicate ) {\n\tvar opts;\n\tvar err;\n\tvar f;\n\n\topts = {};\n\tif ( arguments.length > 1 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t\tf = predicate;\n\t} else {\n\t\tf = options;\n\t}\n\tif ( !isFunction( f ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', f ) );\n\t}\n\tif ( opts.series ) {\n\t\topts.limit = 1;\n\t} else if ( !opts.limit ) {\n\t\topts.limit = PINF;\n\t}\n\treturn someByAsync;\n\n\t/**\n\t* Invokes a predicate function for each element in a collection.\n\t*\n\t* @private\n\t* @param {Collection} collection - input collection\n\t* @param {PositiveInteger} n - number of elements\n\t* @param {Callback} done - function to invoke upon completion\n\t* @throws {TypeError} first argument must be a collection\n\t* @throws {TypeError} second argument must be a positive integer\n\t* @throws {TypeError} last argument must be a function\n\t* @returns {void}\n\t*/\n\tfunction someByAsync( collection, n, done ) {\n\t\tif ( !isCollection( collection ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a collection. Value: `%s`.', collection ) );\n\t\t}\n\t\tif ( !isPositiveInteger( n ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a positive integer. Value: `%s`.', n ) );\n\t\t}\n\t\tif ( !isFunction( done ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t\t}\n\t\treturn limit( collection, n, opts, f, clbk );\n\n\t\t/**\n\t\t* Callback invoked upon completion.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {boolean} bool - test result\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction clbk( error, bool ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error, false );\n\t\t\t}\n\t\t\tdone( null, bool );\n\t\t}\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 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 isPositiveInteger } from '@stdlib/assert-is-positive-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 {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'thisArg': {},\n* 'series': false,\n* 'limit': 10\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, 'thisArg' ) ) {\n\t\topts.thisArg = options.thisArg;\n\t}\n\tif ( hasOwnProp( options, 'series' ) ) {\n\t\topts.series = options.series;\n\t\tif ( !isBoolean( opts.series ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'series', opts.series ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'limit' ) ) {\n\t\topts.limit = options.limit;\n\t\tif ( !isPositiveInteger( opts.limit ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport factory from './factory.js';\n\n\n// MAIN //\n\n/**\n* Tests whether a collection contains at least `n` elements which pass a test implemented by a predicate function.\n*\n* ## Notes\n*\n* - If a predicate function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Collection} collection - input collection\n* @param {PositiveInteger} n - number of elements\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} predicate - predicate function to invoke for each element in a collection\n* @param {Callback} done - function to invoke upon completion\n* @throws {TypeError} first argument must be a collection\n* @throws {TypeError} second argument must be a positive integer\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} second-to-last argument must be a function\n* @throws {TypeError} last argument must be a function\n* @returns {void}\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function done( error, bool ) {\n* if ( error ) {\n* throw error;\n* }\n* if ( bool ) {\n* console.log( 'Successfully read some files.' );\n* } else {\n* console.log( 'Unable to read some files.' );\n* }\n* }\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* someByAsync( files, 2, predicate, done );\n*/\nfunction someByAsync( collection, n, options, predicate, done ) {\n\tif ( arguments.length < 5 ) {\n\t\treturn factory( options )( collection, n, predicate );\n\t}\n\tfactory( options, predicate )( collection, n, done );\n}\n\n\n// EXPORTS //\n\nexport default someByAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\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 whether a collection contains at least `n` elements which pass a test implemented by a predicate function.\n*\n* @module @stdlib/utils-async-some-by\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n* import someByAsync from '@stdlib/utils-async-some-by';\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* function done( error, bool ) {\n* if ( error ) {\n* throw error;\n* }\n* if ( bool ) {\n* console.log( 'Successfully read some files.' );\n* } else {\n* console.log( 'Unable to read some files.' );\n* }\n* }\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* someByAsync( files, 2, predicate, done );\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'some-by-right-async:limit' );\n\n\n// MAIN //\n\n/**\n* Invokes a predicate function once for each element in a collection, limiting the number of concurrently pending functions and iterating from right to left.\n*\n* @private\n* @param {Collection} collection - input collection\n* @param {PositiveInteger} n - number of elements\n* @param {Options} opts - function options\n* @param {*} [opts.thisArg] - execution context\n* @param {PositiveInteger} [opts.limit] - maximum number of pending function invocations\n* @param {Function} predicate - predicate function\n* @param {Callback} done - function to invoke upon completion or upon encountering an error\n* @returns {void}\n*/\nfunction limit( collection, n, opts, predicate, done ) {\n\tvar count;\n\tvar flg;\n\tvar lim;\n\tvar len;\n\tvar idx;\n\tvar cnt;\n\tvar i;\n\n\tlen = collection.length;\n\tdebug( 'Collection length: %d', len );\n\n\tif ( len === 0 ) {\n\t\tdebug( 'Finished processing a collection.' );\n\t\treturn done( null, false );\n\t}\n\tif ( len < opts.limit ) {\n\t\tlim = len;\n\t} else {\n\t\tlim = opts.limit;\n\t}\n\tdebug( 'Concurrency limit: %d', lim );\n\tdebug( 'Number of arguments: %d', predicate.length );\n\n\tcount = 0; // processed element count\n\tidx = len;\n\tcnt = 0; // success count\n\tfor ( i = 0; i < lim; i++ ) {\n\t\t// This guard is necessary to protect against synchronous functions which exhaust all collection elements...\n\t\tif ( idx > 0 ) {\n\t\t\tnext(); // eslint-disable-line node/callback-return\n\t\t}\n\t}\n\n\t/**\n\t* Callback to invoke a provided function for the next element in a collection.\n\t*\n\t* @private\n\t*/\n\tfunction next() {\n\t\tidx -= 1;\n\t\tdebug( 'Collection element %d: %s.', idx, JSON.stringify( collection[ idx ] ) );\n\t\tif ( predicate.length === 2 ) {\n\t\t\tpredicate.call( opts.thisArg, collection[ idx ], clbk );\n\t\t} else if ( predicate.length === 3 ) {\n\t\t\tpredicate.call( opts.thisArg, collection[ idx ], idx, clbk );\n\t\t} else {\n\t\t\tpredicate.call( opts.thisArg, collection[ idx ], idx, collection, clbk ); // eslint-disable-line max-len\n\t\t}\n\t}\n\n\t/**\n\t* Callback invoked once a provided function finishes processing a collection element.\n\t*\n\t* @private\n\t* @param {*} [error] - error\n\t* @param {*} [result] - test result\n\t* @returns {void}\n\t*/\n\tfunction clbk( error, result ) {\n\t\tif ( flg ) {\n\t\t\t// Prevent further processing of collection elements:\n\t\t\treturn;\n\t\t}\n\t\tif ( error ) {\n\t\t\tflg = true;\n\t\t\tdebug( 'Encountered an error: %s', error.message );\n\t\t\treturn done( error );\n\t\t}\n\t\tcount += 1;\n\t\tdebug( 'Processed %d of %d collection elements.', count, len );\n\n\t\tdebug( 'Test result: %s', !!result );\n\t\tif ( result && !flg ) {\n\t\t\tcnt += 1;\n\t\t\tif ( cnt === n ) {\n\t\t\t\tflg = true;\n\t\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\t\treturn done( null, true );\n\t\t\t}\n\t\t}\n\t\tif ( idx > 0 ) {\n\t\t\treturn next();\n\t\t}\n\t\tif ( count === len ) {\n\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\treturn done( null, false );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default limit;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isFunction from '@stdlib/assert-is-function';\nimport { isPrimitive as isPositiveInteger } from '@stdlib/assert-is-positive-integer';\nimport isCollection from '@stdlib/assert-is-collection';\nimport format from '@stdlib/string-format';\nimport PINF from '@stdlib/constants-float64-pinf';\nimport validate from './validate.js';\nimport limit from './limit.js';\n\n\n// MAIN //\n\n/**\n* Returns a function for testing whether a collection contains at least `n` elements which pass a test implemented by a predicate function, iterating from right to left.\n*\n* ## Notes\n*\n* - If a predicate function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} predicate - predicate function to invoke for each element in a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} last argument must be a function\n* @returns {Function} function which invokes the predicate function once for each element in a collection\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* var opts = {\n* 'series': true\n* };\n*\n* // Create a `someByRightAsync` function which invokes the predicate function for each collection element sequentially:\n* var someByRightAsync = factory( opts, predicate );\n*\n* // Create a collection over which to iterate:\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* // Define a callback which handles results:\n* function done( error, bool ) {\n* if ( error ) {\n* throw error;\n* }\n* if ( bool ) {\n* console.log( 'Successfully read some files.' );\n* } else {\n* console.log( 'Unable to read some files.' );\n* }\n* }\n*\n* // Try to read each element in `files`:\n* someByRightAsync( files, 2, done );\n*/\nfunction factory( options, predicate ) {\n\tvar opts;\n\tvar err;\n\tvar f;\n\n\topts = {};\n\tif ( arguments.length > 1 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t\tf = predicate;\n\t} else {\n\t\tf = options;\n\t}\n\tif ( !isFunction( f ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', f ) );\n\t}\n\tif ( opts.series ) {\n\t\topts.limit = 1;\n\t} else if ( !opts.limit ) {\n\t\topts.limit = PINF;\n\t}\n\treturn someByRightAsync;\n\n\t/**\n\t* Invokes a predicate function for each element in a collection, iterating from right to left.\n\t*\n\t* @private\n\t* @param {Collection} collection - input collection\n\t* @param {PositiveInteger} n - number of elements\n\t* @param {Callback} done - function to invoke upon completion\n\t* @throws {TypeError} first argument must be a collection\n\t* @throws {TypeError} second argument must be a positive integer\n\t* @throws {TypeError} last argument must be a function\n\t* @returns {void}\n\t*/\n\tfunction someByRightAsync( collection, n, done ) {\n\t\tif ( !isCollection( collection ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a collection. Value: `%s`.', collection ) );\n\t\t}\n\t\tif ( !isPositiveInteger( n ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a positive integer. Value: `%s`.', n ) );\n\t\t}\n\t\tif ( !isFunction( done ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t\t}\n\t\treturn limit( collection, n, opts, f, clbk );\n\n\t\t/**\n\t\t* Callback invoked upon completion.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {boolean} bool - test result\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction clbk( error, bool ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error, false );\n\t\t\t}\n\t\t\tdone( null, bool );\n\t\t}\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 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 isPositiveInteger } from '@stdlib/assert-is-positive-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 {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'thisArg': {},\n* 'series': false,\n* 'limit': 10\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, 'thisArg' ) ) {\n\t\topts.thisArg = options.thisArg;\n\t}\n\tif ( hasOwnProp( options, 'series' ) ) {\n\t\topts.series = options.series;\n\t\tif ( !isBoolean( opts.series ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'series', opts.series ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'limit' ) ) {\n\t\topts.limit = options.limit;\n\t\tif ( !isPositiveInteger( opts.limit ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport factory from './factory.js';\n\n\n// MAIN //\n\n/**\n* Tests whether a collection contains at least `n` elements which pass a test implemented by a predicate function, iterating from right to left.\n*\n* ## Notes\n*\n* - If a predicate function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* @param {Collection} collection - input collection\n* @param {PositiveInteger} n - number of elements\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} predicate - predicate function to invoke for each element in a collection\n* @param {Callback} done - function to invoke upon completion\n* @throws {TypeError} first argument must be a collection\n* @throws {TypeError} second argument must be a positive integer\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} second-to-last argument must be a function\n* @throws {TypeError} last argument must be a function\n* @returns {void}\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function done( error, bool ) {\n* if ( error ) {\n* throw error;\n* }\n* if ( bool ) {\n* console.log( 'Successfully read some files.' );\n* } else {\n* console.log( 'Unable to read some files.' );\n* }\n* }\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* someByRightAsync( files, 2, predicate, done );\n*/\nfunction someByRightAsync( collection, n, options, predicate, done ) {\n\tif ( arguments.length < 5 ) {\n\t\treturn factory( options )( collection, n, predicate );\n\t}\n\tfactory( options, predicate )( collection, n, done );\n}\n\n\n// EXPORTS //\n\nexport default someByRightAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\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 whether a collection contains at least `n` elements which pass a test implemented by a predicate function, iterating from right to left.\n*\n* @module @stdlib/utils-async-some-by-right\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n* import someByRightAsync from '@stdlib/utils-async-some-by-right';\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* function done( error, bool ) {\n* if ( error ) {\n* throw error;\n* }\n* if ( bool ) {\n* console.log( 'Successfully read some files.' );\n* } else {\n* console.log( 'Unable to read some files.' );\n* }\n* }\n*\n* function predicate( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, false );\n* }\n* next( null, true );\n* }\n* }\n*\n* someByRightAsync( files, 2, predicate, done );\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport indexOf from '@stdlib/utils-index-of';\n\n\n// VARIABLES //\n\nvar debug = logger( 'tabulate-by-async:limit' );\n\n\n// MAIN //\n\n/**\n* Invokes an indicator function once for each element in a collection, limiting the number of concurrently pending functions.\n*\n* @private\n* @param {Collection} collection - input collection\n* @param {Options} opts - function options\n* @param {*} [opts.thisArg] - execution context\n* @param {PositiveInteger} [opts.limit] - maximum number of pending function invocations\n* @param {Function} indicator - indicator function\n* @param {Callback} done - function to invoke upon completion or upon encountering an error\n* @returns {void}\n*/\nfunction limit( collection, opts, indicator, done ) {\n\tvar maxIndex;\n\tvar count;\n\tvar flg;\n\tvar lim;\n\tvar len;\n\tvar idx;\n\tvar out;\n\tvar tmp;\n\tvar i;\n\n\tlen = collection.length;\n\tdebug( 'Collection length: %d', len );\n\n\tout = [];\n\tif ( len === 0 ) {\n\t\tdebug( 'Finished processing a collection.' );\n\t\treturn done( null, out );\n\t}\n\ttmp = [];\n\tif ( len < opts.limit ) {\n\t\tlim = len;\n\t} else {\n\t\tlim = opts.limit;\n\t}\n\tdebug( 'Concurrency limit: %d', lim );\n\tdebug( 'Number of arguments: %d', indicator.length );\n\n\tmaxIndex = len - 1;\n\tcount = 0;\n\tidx = -1;\n\tfor ( i = 0; i < lim; i++ ) {\n\t\t// This guard is necessary to protect against synchronous functions which exhaust all collection elements...\n\t\tif ( idx < maxIndex ) {\n\t\t\tnext(); // eslint-disable-line node/callback-return\n\t\t}\n\t}\n\t/**\n\t* Callback to invoke a provided function for the next element in a collection.\n\t*\n\t* @private\n\t*/\n\tfunction next() {\n\t\tvar v;\n\t\tvar j;\n\n\t\tidx += 1;\n\t\tj = idx;\n\t\tv = collection[ j ];\n\n\t\tdebug( 'Collection element %d: %s.', j, JSON.stringify( v ) );\n\t\tif ( indicator.length === 2 ) {\n\t\t\tindicator.call( opts.thisArg, v, cb );\n\t\t} else if ( indicator.length === 3 ) {\n\t\t\tindicator.call( opts.thisArg, v, j, cb );\n\t\t} else {\n\t\t\tindicator.call( opts.thisArg, v, j, collection, cb );\n\t\t}\n\t\t/**\n\t\t* Callback invoked once a provided function finishes processing a collection element.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {*} [group] - group\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction cb( error, group ) {\n\t\t\tvar i;\n\t\t\tif ( flg ) {\n\t\t\t\t// Prevent further processing of collection elements:\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( error ) {\n\t\t\t\tflg = true;\n\t\t\t\treturn clbk( error );\n\t\t\t}\n\t\t\tdebug( 'Collection element %d group: %s.', j, group );\n\n\t\t\t// Determine if we've seen the group/category before. If not, cache a reference which points to its location in the output array; otherwise, update the running count.\n\t\t\ti = indexOf( tmp, group );\n\t\t\tif ( i === -1 ) {\n\t\t\t\ttmp.push( group );\n\t\t\t\tout.push( [ group, 1, 0 ] );\n\t\t\t} else {\n\t\t\t\tout[ i ][ 1 ] += 1;\n\t\t\t}\n\t\t\tclbk();\n\t\t}\n\t}\n\n\t/**\n\t* Callback invoked once ready to process the next collection element.\n\t*\n\t* @private\n\t* @param {*} [error] - error\n\t* @returns {void}\n\t*/\n\tfunction clbk( error ) {\n\t\tvar i;\n\t\tif ( error ) {\n\t\t\tdebug( 'Encountered an error: %s', error.message );\n\t\t\treturn done( error );\n\t\t}\n\t\tcount += 1;\n\t\tdebug( 'Processed %d of %d collection elements.', count, len );\n\t\tif ( idx < maxIndex ) {\n\t\t\treturn next();\n\t\t}\n\t\tif ( count === len ) {\n\t\t\t// Compute percentages...\n\t\t\tfor ( i = 0; i < out.length; i++ ) {\n\t\t\t\tout[ i ][ 2 ] = out[ i ][ 1 ] / count;\n\t\t\t}\n\t\t\tdebug( 'Finished processing a collection.' );\n\t\t\treturn done( null, out );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default limit;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 isCollection from '@stdlib/assert-is-collection';\nimport format from '@stdlib/string-format';\nimport PINF from '@stdlib/constants-float64-pinf';\nimport validate from './validate.js';\nimport limit from './limit.js';\n\n\n// MAIN //\n\n/**\n* Returns a function for generating a frequency table according to an indicator function.\n*\n* ## Notes\n*\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* - The output frequency table is an array of arrays. Each sub-array corresponds to a unique value in the input collection and is structured as follows:\n*\n* - 0: unique value\n* - 1: value count\n* - 2: frequency percentage\n*\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} indicator - function whose return values are used to populate the output frequency table\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} last argument must be a function\n* @returns {Function} function which invokes the indicator function once for each element in a collection\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function indicator( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, 'nonreadable' );\n* }\n* next( null, 'readable' );\n* }\n* }\n*\n* var opts = {\n* 'series': true\n* };\n*\n* // Create a `tabulateByAsync` function which invokes the indicator function for each collection element sequentially:\n* var tabulateByAsync = factory( opts, indicator );\n*\n* // Create a collection over which to iterate:\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* // Define a callback which handles results:\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* }\n*\n* // Try to read each element in `files`:\n* tabulateByAsync( files, done );\n*/\nfunction factory( options, indicator ) {\n\tvar opts;\n\tvar err;\n\tvar f;\n\n\topts = {};\n\tif ( arguments.length > 1 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t\tf = indicator;\n\t} else {\n\t\tf = options;\n\t}\n\tif ( !isFunction( f ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', f ) );\n\t}\n\tif ( opts.series ) {\n\t\topts.limit = 1;\n\t} else if ( !opts.limit ) {\n\t\topts.limit = PINF;\n\t}\n\treturn tabulateByAsync;\n\n\t/**\n\t* Invokes an indicator function for each element in a collection.\n\t*\n\t* @private\n\t* @param {Collection} collection - input collection\n\t* @param {Callback} done - function to invoke upon completion\n\t* @throws {TypeError} first argument must be a collection\n\t* @throws {TypeError} last argument must be a function\n\t* @returns {void}\n\t*/\n\tfunction tabulateByAsync( collection, done ) {\n\t\tif ( !isCollection( collection ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a collection. Value: `%s`.', collection ) );\n\t\t}\n\t\tif ( !isFunction( done ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t\t}\n\t\treturn limit( collection, opts, f, clbk );\n\n\t\t/**\n\t\t* Callback invoked upon completion.\n\t\t*\n\t\t* @private\n\t\t* @param {*} [error] - error\n\t\t* @param {Object} result - frequency table\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction clbk( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\tdone( null, result );\n\t\t}\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 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 isPositiveInteger } from '@stdlib/assert-is-positive-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 {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'thisArg': {},\n* 'series': false,\n* 'limit': 10\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, 'thisArg' ) ) {\n\t\topts.thisArg = options.thisArg;\n\t}\n\tif ( hasOwnProp( options, 'series' ) ) {\n\t\topts.series = options.series;\n\t\tif ( !isBoolean( opts.series ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'series', opts.series ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'limit' ) ) {\n\t\topts.limit = options.limit;\n\t\tif ( !isPositiveInteger( opts.limit ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport factory from './factory.js';\n\n\n// MAIN //\n\n/**\n* Generates a frequency table according to an indicator function.\n*\n* ## Notes\n*\n* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).\n*\n* - The output frequency table is an array of arrays. Each sub-array corresponds to a unique value in the input collection and is structured as follows:\n*\n* - 0: unique value\n* - 1: value count\n* - 2: frequency percentage\n*\n* @param {Collection} collection - input collection\n* @param {Options} [options] - function options\n* @param {*} [options.thisArg] - execution context\n* @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time\n* @param {boolean} [options.series=false] - boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection\n* @param {Function} indicator - function whose return values are used to populate the output frequency table\n* @param {Callback} done - function to invoke upon completion\n* @throws {TypeError} first argument must be a collection\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {TypeError} second-to-last argument must be a function\n* @throws {TypeError} last argument must be a function\n* @returns {void}\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* }\n*\n* function indicator( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, 'nonreadable' );\n* }\n* next( null, 'readable' );\n* }\n* }\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* tabulateByAsync( files, indicator, done );\n*/\nfunction tabulateByAsync( collection, options, indicator, done ) {\n\tif ( arguments.length < 4 ) {\n\t\treturn factory( options )( collection, indicator );\n\t}\n\tfactory( options, indicator )( collection, done );\n}\n\n\n// EXPORTS //\n\nexport default tabulateByAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Generate a frequency table according to an indicator function.\n*\n* @module @stdlib/utils-async-tabulate-by\n*\n* @example\n* import readFile from '@stdlib/fs-read-file';\n* import tabulateByAsync from '@stdlib/utils-async-tabulate-by';\n*\n* var files = [\n* './beep.js',\n* './boop.js'\n* ];\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* }\n*\n* function indicator( file, next ) {\n* var opts = {\n* 'encoding': 'utf8'\n* };\n* readFile( file, opts, onFile );\n*\n* function onFile( error ) {\n* if ( error ) {\n* return next( null, 'nonreadable' );\n* }\n* next( null, 'readable' );\n* }\n* }\n*\n* tabulateByAsync( files, indicator, done );\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/*\n* When adding modules to the namespace, ensure that they are added in alphabetical order according to module name.\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-read-only-property';\n\n\n// MAIN //\n\n/**\n* Top-level namespace.\n*\n* @namespace ns\n*/\nvar ns = {};\n\n/**\n* @name anyByAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/any-by}\n*/\nimport anyByAsync from '@stdlib/utils-async-any-by';\nsetReadOnly( ns, 'anyByAsync', anyByAsync );\n\n/**\n* @name anyByRightAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/any-by-right}\n*/\nimport anyByRightAsync from '@stdlib/utils-async-any-by-right';\nsetReadOnly( ns, 'anyByRightAsync', anyByRightAsync );\n\n/**\n* @name bifurcateByAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/bifurcate-by}\n*/\nimport bifurcateByAsync from '@stdlib/utils-async-bifurcate-by';\nsetReadOnly( ns, 'bifurcateByAsync', bifurcateByAsync );\n\n/**\n* @name composeAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/compose}\n*/\nimport composeAsync from '@stdlib/utils-async-compose';\nsetReadOnly( ns, 'composeAsync', composeAsync );\n\n/**\n* @name countByAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/count-by}\n*/\nimport countByAsync from '@stdlib/utils-async-count-by';\nsetReadOnly( ns, 'countByAsync', countByAsync );\n\n/**\n* @name doUntilAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/do-until}\n*/\nimport doUntilAsync from '@stdlib/utils-async-do-until';\nsetReadOnly( ns, 'doUntilAsync', doUntilAsync );\n\n/**\n* @name doWhileAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/do-while}\n*/\nimport doWhileAsync from '@stdlib/utils-async-do-while';\nsetReadOnly( ns, 'doWhileAsync', doWhileAsync );\n\n/**\n* @name everyByAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/every-by}\n*/\nimport everyByAsync from '@stdlib/utils-async-every-by';\nsetReadOnly( ns, 'everyByAsync', everyByAsync );\n\n/**\n* @name everyByRightAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/every-by-right}\n*/\nimport everyByRightAsync from '@stdlib/utils-async-every-by-right';\nsetReadOnly( ns, 'everyByRightAsync', everyByRightAsync );\n\n/**\n* @name forEachAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/for-each}\n*/\nimport forEachAsync from '@stdlib/utils-async-for-each';\nsetReadOnly( ns, 'forEachAsync', forEachAsync );\n\n/**\n* @name forEachRightAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/for-each-right}\n*/\nimport forEachRightAsync from '@stdlib/utils-async-for-each-right';\nsetReadOnly( ns, 'forEachRightAsync', forEachRightAsync );\n\n/**\n* @name functionSequenceAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/function-sequence}\n*/\nimport functionSequenceAsync from '@stdlib/utils-async-function-sequence';\nsetReadOnly( ns, 'functionSequenceAsync', functionSequenceAsync );\n\n/**\n* @name groupByAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/group-by}\n*/\nimport groupByAsync from '@stdlib/utils-async-group-by';\nsetReadOnly( ns, 'groupByAsync', groupByAsync );\n\n/**\n* @name ifelseAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/if-else}\n*/\nimport ifelseAsync from '@stdlib/utils-async-if-else';\nsetReadOnly( ns, 'ifelseAsync', ifelseAsync );\n\n/**\n* @name ifthenAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/if-then}\n*/\nimport ifthenAsync from '@stdlib/utils-async-if-then';\nsetReadOnly( ns, 'ifthenAsync', ifthenAsync );\n\n/**\n* @name inmapAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/inmap}\n*/\nimport inmapAsync from '@stdlib/utils-async-inmap';\nsetReadOnly( ns, 'inmapAsync', inmapAsync );\n\n/**\n* @name inmapRightAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/inmap-right}\n*/\nimport inmapRightAsync from '@stdlib/utils-async-inmap-right';\nsetReadOnly( ns, 'inmapRightAsync', inmapRightAsync );\n\n/**\n* @name mapFunAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/map-function}\n*/\nimport mapFunAsync from '@stdlib/utils-async-map-function';\nsetReadOnly( ns, 'mapFunAsync', mapFunAsync );\n\n/**\n* @name mapKeysAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/map-keys}\n*/\nimport mapKeysAsync from '@stdlib/utils-async-map-keys';\nsetReadOnly( ns, 'mapKeysAsync', mapKeysAsync );\n\n/**\n* @name mapValuesAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/map-values}\n*/\nimport mapValuesAsync from '@stdlib/utils-async-map-values';\nsetReadOnly( ns, 'mapValuesAsync', mapValuesAsync );\n\n/**\n* @name noneByAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/none-by}\n*/\nimport noneByAsync from '@stdlib/utils-async-none-by';\nsetReadOnly( ns, 'noneByAsync', noneByAsync );\n\n/**\n* @name noneByRightAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/none-by-right}\n*/\nimport noneByRightAsync from '@stdlib/utils-async-none-by-right';\nsetReadOnly( ns, 'noneByRightAsync', noneByRightAsync );\n\n/**\n* @name reduceAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/reduce}\n*/\nimport reduceAsync from '@stdlib/utils-async-reduce';\nsetReadOnly( ns, 'reduceAsync', reduceAsync );\n\n/**\n* @name reduceRightAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/reduce-right}\n*/\nimport reduceRightAsync from '@stdlib/utils-async-reduce-right';\nsetReadOnly( ns, 'reduceRightAsync', reduceRightAsync );\n\n/**\n* @name waterfall\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/series-waterfall}\n*/\nimport waterfall from '@stdlib/utils-async-series-waterfall';\nsetReadOnly( ns, 'waterfall', waterfall );\n\n/**\n* @name someByAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/some-by}\n*/\nimport someByAsync from '@stdlib/utils-async-some-by';\nsetReadOnly( ns, 'someByAsync', someByAsync );\n\n/**\n* @name someByRightAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/some-by-right}\n*/\nimport someByRightAsync from '@stdlib/utils-async-some-by-right';\nsetReadOnly( ns, 'someByRightAsync', someByRightAsync );\n\n/**\n* @name tabulateByAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/tabulate-by}\n*/\nimport tabulateByAsync from '@stdlib/utils-async-tabulate-by';\nsetReadOnly( ns, 'tabulateByAsync', tabulateByAsync );\n\n/**\n* @name trycatchAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/try-catch}\n*/\nimport trycatchAsync from '@stdlib/utils-async-try-catch';\nsetReadOnly( ns, 'trycatchAsync', trycatchAsync );\n\n/**\n* @name trythenAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/try-then}\n*/\nimport trythenAsync from '@stdlib/utils-async-try-then';\nsetReadOnly( ns, 'trythenAsync', trythenAsync );\n\n/**\n* @name untilAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/until}\n*/\nimport untilAsync from '@stdlib/utils-async-until';\nsetReadOnly( ns, 'untilAsync', untilAsync );\n\n/**\n* @name whileAsync\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/utils/async/while}\n*/\nimport whileAsync from '@stdlib/utils-async-while';\nsetReadOnly( ns, 'whileAsync', whileAsync );\n\n\n// EXPORTS //\n\nexport default ns;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 format from '@stdlib/string-format';\n\n\n// MAIN //\n\n/**\n* Function composition.\n*\n* @param {...Function} f - functions to compose\n* @throws {Error} must provide more than one argument\n* @throws {TypeError} must provide functions\n* @returns {Function} composite function\n*\n* @example\n* function a( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, 2*x );\n* }\n* }\n*\n* function b( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x+3 );\n* }\n* }\n*\n* function c( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x/5 );\n* }\n* }\n*\n* var f = composeAsync( c, b, a );\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* // => 3\n* }\n*\n* f( 6, done );\n*/\nfunction composeAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to compose.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) );\n\t\t}\n\t}\n\treturn composite;\n\n\t/**\n\t* Composite function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction composite() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = nFuncs - 1;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a composed function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti -= 1;\n\t\t\tif ( i < 0 ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default composeAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 format from '@stdlib/string-format';\n\n\n// MAIN //\n\n/**\n* Invokes a function until a test condition is true.\n*\n* @param {Function} fcn - function to invoke\n* @param {Function} predicate - function which indicates whether to continue invoking a function\n* @param {Callback} done - callback to invoke upon completion\n* @param {*} [thisArg] - execution context for the invoked function\n* @throws {TypeError} first argument must be a function\n* @throws {TypeError} second argument must be a function\n* @throws {TypeError} third argument must be a function\n*\n* @example\n* function fcn( i, next ) {\n* setTimeout( onTimeout, i );\n* function onTimeout() {\n* console.log( 'beep: %d', i );\n* next();\n* }\n* }\n*\n* function predicate( i, clbk ) {\n* clbk( null, i >= 5 );\n* }\n*\n* function done( error ) {\n* if ( error ) {\n* throw error;\n* }\n* }\n*\n* doUntilAsync( fcn, predicate, done );\n*/\nfunction doUntilAsync( fcn, predicate, done, thisArg ) {\n\tvar args;\n\tvar idx;\n\tif ( !isFunction( fcn ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', fcn ) );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a function. Value: `%s`.', predicate ) );\n\t}\n\tif ( !isFunction( done ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Third argument must be a function. Value: `%s`.', done ) );\n\t}\n\targs = [];\n\tidx = 0;\n\tfcn.call( thisArg, idx, next );\n\n\t/**\n\t* Callback invoked upon completion of a provided function.\n\t*\n\t* @private\n\t* @param {(Error|null)} error - error object\n\t* @param {...*} results - function results\n\t* @returns {void}\n\t*/\n\tfunction next( error ) {\n\t\tvar i;\n\t\tif ( error ) {\n\t\t\treturn done( error );\n\t\t}\n\t\tidx += 1;\n\n\t\t// Cache the most recent results...\n\t\tif ( arguments.length > 1 ) {\n\t\t\targs = new Array( arguments.length-1 );\n\t\t\tfor ( i = 1; i < arguments.length; i++ ) {\n\t\t\t\targs[ i-1 ] = arguments[ i ];\n\t\t\t}\n\t\t}\n\t\t// Run the test condition:\n\t\tpredicate( idx, onPredicate );\n\t}\n\n\t/**\n\t* Callback invoked upon a predicate result.\n\t*\n\t* @private\n\t* @param {(Error|null)} error - error object\n\t* @param {boolean} result - predicate result\n\t* @returns {void}\n\t*/\n\tfunction onPredicate( error, result ) {\n\t\tif ( error ) {\n\t\t\treturn done( error );\n\t\t}\n\t\tif ( !result ) {\n\t\t\treturn fcn.call( thisArg, idx, next );\n\t\t}\n\t\tif ( args.length ) {\n\t\t\targs.unshift( null ); // error argument\n\t\t}\n\t\tdone.apply( null, args );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default doUntilAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 format from '@stdlib/string-format';\n\n\n// MAIN //\n\n/**\n* Invokes a function while a test condition is true.\n*\n* @param {Function} fcn - function to invoke\n* @param {Function} predicate - function which indicates whether to continue invoking a function\n* @param {Callback} done - callback to invoke upon completion\n* @param {*} [thisArg] - execution context for the invoked function\n* @throws {TypeError} first argument must be a function\n* @throws {TypeError} second argument must be a function\n* @throws {TypeError} third argument must be a function\n*\n* @example\n* function fcn( i, next ) {\n* setTimeout( onTimeout, i );\n* function onTimeout() {\n* console.log( 'beep: %d', i );\n* next();\n* }\n* }\n*\n* function predicate( i, clbk ) {\n* clbk( null, i < 5 );\n* }\n*\n* function done( error ) {\n* if ( error ) {\n* throw error;\n* }\n* }\n*\n* doWhileAsync( fcn, predicate, done );\n*/\nfunction doWhileAsync( fcn, predicate, done, thisArg ) {\n\tvar args;\n\tvar idx;\n\tif ( !isFunction( fcn ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', fcn ) );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a function. Value: `%s`.', predicate ) );\n\t}\n\tif ( !isFunction( done ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Third argument must be a function. Value: `%s`.', done ) );\n\t}\n\targs = [];\n\tidx = 0;\n\tfcn.call( thisArg, idx, next );\n\n\t/**\n\t* Callback invoked upon completion of a provided function.\n\t*\n\t* @private\n\t* @param {(Error|null)} error - error object\n\t* @param {...*} results - function results\n\t* @returns {void}\n\t*/\n\tfunction next( error ) {\n\t\tvar i;\n\t\tif ( error ) {\n\t\t\treturn done( error );\n\t\t}\n\t\tidx += 1;\n\n\t\t// Cache the most recent results...\n\t\tif ( arguments.length > 1 ) {\n\t\t\targs = new Array( arguments.length-1 );\n\t\t\tfor ( i = 1; i < arguments.length; i++ ) {\n\t\t\t\targs[ i-1 ] = arguments[ i ];\n\t\t\t}\n\t\t}\n\t\t// Run the test condition:\n\t\tpredicate( idx, onPredicate );\n\t}\n\n\t/**\n\t* Callback invoked upon a predicate result.\n\t*\n\t* @private\n\t* @param {(Error|null)} error - error object\n\t* @param {boolean} result - predicate result\n\t* @returns {void}\n\t*/\n\tfunction onPredicate( error, result ) {\n\t\tif ( error ) {\n\t\t\treturn done( error );\n\t\t}\n\t\tif ( result ) {\n\t\t\treturn fcn.call( thisArg, idx, next );\n\t\t}\n\t\tif ( args.length ) {\n\t\t\targs.unshift( null ); // error argument\n\t\t}\n\t\tdone.apply( null, args );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default doWhileAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 format from '@stdlib/string-format';\n\n\n// MAIN //\n\n/**\n* Function sequence.\n*\n* @param {...Function} f - functions to evaluate in sequential order\n* @throws {Error} must provide more than one argument\n* @throws {TypeError} must provide functions\n* @returns {Function} pipeline function\n*\n* @example\n* function a( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, 2*x );\n* }\n* }\n*\n* function b( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x+3 );\n* }\n* }\n*\n* function c( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x/5 );\n* }\n* }\n*\n* var f = funseqAsync( a, b, c );\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* // => 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 format from '@stdlib/string-format';\n\n\n// MAIN //\n\n/**\n* If a predicate function returns a truthy value, returns `x`; otherwise, returns `y`.\n*\n* @param {Function} predicate - predicate function\n* @param {*} x - value to return if a condition is truthy\n* @param {*} y - value to return if a condition is falsy\n* @param {Function} done - callback to invoke upon completion\n* @throws {TypeError} first argument must be a function\n* @throws {TypeError} last argument must be a function\n*\n* @example\n* import randu from '@stdlib/random-base-randu';\n*\n* function predicate( clbk ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* clbk( null, randu() > 0.5 );\n* }\n* }\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* }\n* ifelseAsync( predicate, 1.0, -1.0, done );\n*/\nfunction ifelseAsync( predicate, x, y, done ) {\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) );\n\t}\n\tif ( !isFunction( done ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t}\n\tpredicate( clbk );\n\n\t/**\n\t* Callback invoked by a predicate function.\n\t*\n\t* @private\n\t* @param {(Error|null)} error - error object\n\t* @param {boolean} bool - condition\n\t* @returns {void}\n\t*/\n\tfunction clbk( error, bool ) {\n\t\tif ( error ) {\n\t\t\treturn done( error );\n\t\t}\n\t\tif ( bool ) {\n\t\t\treturn done( null, x );\n\t\t}\n\t\tdone( null, y );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default ifelseAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 format from '@stdlib/string-format';\n\n\n// MAIN //\n\n/**\n* If a predicate function returns a truthy value, invokes `x`; otherwise, invokes `y`.\n*\n* @param {Function} predicate - predicate function\n* @param {Function} x - function to invoke if a condition is truthy\n* @param {Function} y - function to invoke if a condition is falsy\n* @param {Function} done - callback to invoke upon completion\n* @throws {TypeError} first argument must be a function\n* @throws {TypeError} second argument must be a function\n* @throws {TypeError} third argument must be a function\n* @throws {TypeError} last argument must be a function\n*\n* @example\n* import randu from '@stdlib/random-base-randu';\n*\n* function predicate( clbk ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* clbk( null, randu() > 0.5 );\n* }\n* }\n*\n* function x( clbk ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* clbk( null, 1.0 );\n* }\n* }\n*\n* function y( clbk ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* clbk( null, -1.0 );\n* }\n* }\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* }\n* ifthenAsync( predicate, x, y, done );\n*/\nfunction ifthenAsync( predicate, x, y, done ) {\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) );\n\t}\n\tif ( !isFunction( x ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a function. Value: `%s`.', x ) );\n\t}\n\tif ( !isFunction( y ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Third argument must be a function. Value: `%s`.', y ) );\n\t}\n\tif ( !isFunction( done ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t}\n\tpredicate( clbk1 );\n\n\t/**\n\t* Callback invoked by a predicate function.\n\t*\n\t* @private\n\t* @param {(Error|null)} error - error object\n\t* @param {boolean} bool - condition\n\t* @returns {void}\n\t*/\n\tfunction clbk1( error, bool ) {\n\t\tif ( error ) {\n\t\t\treturn done( error );\n\t\t}\n\t\tif ( bool ) {\n\t\t\treturn x( clbk2 );\n\t\t}\n\t\ty( clbk2 );\n\t}\n\n\t/**\n\t* Callback invoked by either `x` or `y`.\n\t*\n\t* @private\n\t* @param {(Error|null)} error - error object\n\t* @param {...*} args - results\n\t* @returns {void}\n\t*/\n\tfunction clbk2( error ) {\n\t\tvar nargs;\n\t\tvar args;\n\t\tvar i;\n\t\tif ( error ) {\n\t\t\treturn done( error );\n\t\t}\n\t\tnargs = arguments.length;\n\t\targs = new Array( nargs );\n\t\targs[ 0 ] = null;\n\t\tfor ( i = 1; i < nargs; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\tdone.apply( null, args );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default ifthenAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 format from '@stdlib/string-format';\n\n\n// MAIN //\n\n/**\n* If a function does not return an error, invokes a callback with the function result; otherwise, invokes a callback with a value `y`.\n*\n* @param {Function} x - function to invoke\n* @param {*} y - value to return if `x` returns an error\n* @param {Function} done - callback to invoke upon completion\n* @throws {TypeError} first argument must be a function\n* @throws {TypeError} last argument must be a function\n*\n* @example\n* import randu from '@stdlib/random-base-randu';\n*\n* function x( clbk ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* if ( randu() > 0.5 ) {\n* return clbk( null, 1.0 );\n* }\n* clbk( new Error( 'beep' ) );\n* }\n* }\n*\n* function done( error, result ) {\n* if ( error ) {\n* console.log( error.message );\n* }\n* console.log( result );\n* }\n*\n* trycatchAsync( x, -1.0, done );\n*/\nfunction trycatchAsync( x, y, done ) {\n\tif ( !isFunction( x ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', x ) );\n\t}\n\tif ( !isFunction( done ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t}\n\tx( clbk );\n\n\t/**\n\t* Callback invoked by `x`.\n\t*\n\t* @private\n\t* @param {(Error|null)} error - error object\n\t* @param {*} result - result\n\t* @returns {void}\n\t*/\n\tfunction clbk( error, result ) {\n\t\tif ( error ) {\n\t\t\treturn done( error, y );\n\t\t}\n\t\tdone( null, result );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default trycatchAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 format from '@stdlib/string-format';\n\n\n// MAIN //\n\n/**\n* If a function does not return an error, invokes a callback with the function result; otherwise, invokes a second function `y`.\n*\n* @param {Function} x - function to invoke\n* @param {Function} y - function to invoke if `x` returns an error\n* @param {Function} done - callback to invoke upon completion\n* @throws {TypeError} first argument must be a function\n* @throws {TypeError} second argument must be a function\n* @throws {TypeError} last argument must be a function\n*\n* @example\n* import randu from '@stdlib/random-base-randu';\n*\n* function x( clbk ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* if ( randu() > 0.5 ) {\n* return clbk( null, 1.0 );\n* }\n* clbk( new Error( 'beep' ) );\n* }\n* }\n*\n* function y( clbk ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* clbk( null, -1.0 );\n* }\n* }\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* }\n*\n* trythenAsync( x, y, done );\n*/\nfunction trythenAsync( x, y, done ) {\n\tif ( !isFunction( x ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', x ) );\n\t}\n\tif ( !isFunction( y ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a function. Value: `%s`.', y ) );\n\t}\n\tif ( !isFunction( done ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );\n\t}\n\tx( clbk1 );\n\n\t/**\n\t* Callback invoked by `x`.\n\t*\n\t* @private\n\t* @param {(Error|null)} error - error object\n\t* @param {...*} args - function results\n\t* @returns {void}\n\t*/\n\tfunction clbk1( error ) {\n\t\tvar nargs;\n\t\tvar args;\n\t\tvar i;\n\t\tif ( error ) {\n\t\t\tif ( y.length === 1 ) {\n\t\t\t\treturn y( clbk2 );\n\t\t\t}\n\t\t\treturn y( error, clbk2 );\n\t\t}\n\t\tnargs = arguments.length;\n\t\targs = new Array( nargs );\n\t\targs[ 0 ] = null;\n\t\tfor ( i = 1; i < nargs; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\treturn done.apply( null, args );\n\t}\n\n\t/**\n\t* Callback invoked by `y`.\n\t*\n\t* @private\n\t* @param {(Error|null)} error - error object\n\t* @param {...*} args - function results\n\t* @returns {void}\n\t*/\n\tfunction clbk2( error ) {\n\t\tvar nargs;\n\t\tvar args;\n\t\tvar i;\n\t\tif ( error ) {\n\t\t\treturn done( error );\n\t\t}\n\t\tnargs = arguments.length;\n\t\targs = new Array( nargs );\n\t\targs[ 0 ] = null;\n\t\tfor ( i = 1; i < nargs; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\treturn done.apply( null, args );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default trythenAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 format from '@stdlib/string-format';\n\n\n// MAIN //\n\n/**\n* Invokes a function until a test condition is true.\n*\n* @param {Function} predicate - function which indicates whether to continue invoking a function\n* @param {Function} fcn - function to invoke\n* @param {Callback} done - callback to invoke upon completion\n* @param {*} [thisArg] - execution context for the invoked function\n* @throws {TypeError} first argument must be a function\n* @throws {TypeError} second argument must be a function\n* @throws {TypeError} third argument must be a function\n*\n* @example\n* function predicate( i, clbk ) {\n* clbk( null, i >= 5 );\n* }\n*\n* function fcn( i, next ) {\n* setTimeout( onTimeout, i );\n* function onTimeout() {\n* console.log( 'beep: %d', i );\n* next();\n* }\n* }\n*\n* function done( error ) {\n* if ( error ) {\n* throw error;\n* }\n* }\n*\n* untilAsync( predicate, fcn, done );\n*/\nfunction untilAsync( predicate, fcn, done, thisArg ) {\n\tvar args;\n\tvar idx;\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) );\n\t}\n\tif ( !isFunction( fcn ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a function. Value: `%s`.', fcn ) );\n\t}\n\tif ( !isFunction( done ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Third argument must be a function. Value: `%s`.', done ) );\n\t}\n\targs = [];\n\tidx = 0;\n\tpredicate( idx, onPredicate );\n\n\t/**\n\t* Callback invoked upon a predicate result.\n\t*\n\t* @private\n\t* @param {(Error|null)} error - error object\n\t* @param {boolean} result - predicate result\n\t* @returns {void}\n\t*/\n\tfunction onPredicate( error, result ) {\n\t\tif ( error ) {\n\t\t\treturn done( error );\n\t\t}\n\t\tif ( !result ) {\n\t\t\treturn fcn.call( thisArg, idx, next );\n\t\t}\n\t\tif ( args.length ) {\n\t\t\targs.unshift( null ); // error argument\n\t\t}\n\t\tdone.apply( null, args );\n\t}\n\n\t/**\n\t* Callback invoked upon completion of a provided function.\n\t*\n\t* @private\n\t* @param {(Error|null)} error - error object\n\t* @param {...*} results - function results\n\t* @returns {void}\n\t*/\n\tfunction next( error ) {\n\t\tvar i;\n\t\tif ( error ) {\n\t\t\treturn done( error );\n\t\t}\n\t\tidx += 1;\n\n\t\t// Cache the most recent results...\n\t\tif ( arguments.length > 1 ) {\n\t\t\targs = new Array( arguments.length-1 );\n\t\t\tfor ( i = 1; i < arguments.length; i++ ) {\n\t\t\t\targs[ i-1 ] = arguments[ i ];\n\t\t\t}\n\t\t}\n\t\t// Run the test condition:\n\t\tpredicate( idx, onPredicate );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default untilAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See 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 format from '@stdlib/string-format';\n\n\n// MAIN //\n\n/**\n* Invokes a function while a test condition is true.\n*\n* @param {Function} predicate - function which indicates whether to continue invoking a function\n* @param {Function} fcn - function to invoke\n* @param {Callback} done - callback to invoke upon completion\n* @param {*} [thisArg] - execution context for the invoked function\n* @throws {TypeError} first argument must be a function\n* @throws {TypeError} second argument must be a function\n* @throws {TypeError} third argument must be a function\n*\n* @example\n* function predicate( i, clbk ) {\n* clbk( null, i < 5 );\n* }\n*\n* function fcn( i, next ) {\n* setTimeout( onTimeout, i );\n* function onTimeout() {\n* console.log( 'beep: %d', i );\n* next();\n* }\n* }\n*\n* function done( error ) {\n* if ( error ) {\n* throw error;\n* }\n* }\n*\n* whileAsync( predicate, fcn, done );\n*/\nfunction whileAsync( predicate, fcn, done, thisArg ) {\n\tvar args;\n\tvar idx;\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) );\n\t}\n\tif ( !isFunction( fcn ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a function. Value: `%s`.', fcn ) );\n\t}\n\tif ( !isFunction( done ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Third argument must be a function. Value: `%s`.', done ) );\n\t}\n\targs = [];\n\tidx = 0;\n\tpredicate( idx, onPredicate );\n\n\t/**\n\t* Callback invoked upon a predicate result.\n\t*\n\t* @private\n\t* @param {(Error|null)} error - error object\n\t* @param {boolean} result - predicate result\n\t* @returns {void}\n\t*/\n\tfunction onPredicate( error, result ) {\n\t\tif ( error ) {\n\t\t\treturn done( error );\n\t\t}\n\t\tif ( result ) {\n\t\t\treturn fcn.call( thisArg, idx, next );\n\t\t}\n\t\tif ( args.length ) {\n\t\t\targs.unshift( null ); // error argument\n\t\t}\n\t\tdone.apply( null, args );\n\t}\n\n\t/**\n\t* Callback invoked upon completion of a provided function.\n\t*\n\t* @private\n\t* @param {(Error|null)} error - error object\n\t* @param {...*} results - function results\n\t* @returns {void}\n\t*/\n\tfunction next( error ) {\n\t\tvar i;\n\t\tif ( error ) {\n\t\t\treturn done( error );\n\t\t}\n\t\tidx += 1;\n\n\t\t// Cache the most recent results...\n\t\tif ( arguments.length > 1 ) {\n\t\t\targs = new Array( arguments.length-1 );\n\t\t\tfor ( i = 1; i < arguments.length; i++ ) {\n\t\t\t\targs[ i-1 ] = arguments[ i ];\n\t\t\t}\n\t\t}\n\t\t// Run the test condition:\n\t\tpredicate( idx, onPredicate );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default whileAsync;\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","root","codegen","Function","GlobalThis","Self","Win","Global","getGlobal","nodeList","document","childNodes","typedarray","Int8Array","reFunctionName","RE_FUNCTION_NAME","REGEXP","main$3","isObjectLike","constructorName","name","ctor","constructor","_isBuffer","isBuffer","predicate","len","arrayfun","ctorName","type","isFunction","typeOf","floor","isInteger","x","MAX_TYPED_ARRAY_LENGTH","isCollection","MAX_LENGTH","FLOAT64_PINF","Number","POSITIVE_INFINITY","getProto","Obj","getPrototypeOf","proto","getProto$1","objectPrototype","isPlainObject","isPrototypeOf","key","ownProps","main$1","FLOAT64_NINF","NEGATIVE_INFINITY","PINF","NINF","isInt","valueOf","isPositiveInteger","debug","require$$0","factory","options","opts","thisArg","series","limit","validate","collection","done","maxIndex","count","flg","lim","idx","next","JSON","stringify","clbk","error","result","message","bool","anyByAsync","anyByRightAsync","isNan","isString","arr","searchElement","fromIndex","returns","join","cb","results","bifurcateByAsync","indicator","group","countByAsync","everyByAsync","everyByRightAsync","fcn","forEachAsync","forEachRightAsync","groupByAsync","inmapAsync","inmapRightAsync","isNonNegativeInteger","m","mapFunAsync","keys","isArguments","bool$5","detect","hasArgumentsClass","isEnumerableProperty","propertyIsEnumerable","hasStringEnumBug","isEnum","isArguments$1","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","NON_ENUMERABLE","transform","objectKeys","mapKeysAsync","mapValuesAsync","noneByAsync","noneByRightAsync","initial","acc","reduceAsync","reduceRightAsync","MAX_ARRAY_LENGTH","isFunctionArray","isArrayLike","fcns","waterfall","cnt","someByAsync","someByRightAsync","tmp","tabulateByAsync","ns","nFuncs","onPredicate","unshift","y","clbk2","nargs"],"mappings":";mOAsBA,IAAIA,EAA0C,mBAA1BC,OAAOC,eAAkCD,OAAOC,eAAiB,KCiCrF,IAAIA,EAAiBD,OAAOC,eCjB5B,SAASC,EAAUC,GAClB,MAA0B,iBAAVA,CACjB,CCAA,SAASC,EAAOC,GACf,IACIC,EADAC,EAAM,GAEV,IAAMD,EAAI,EAAGA,EAAID,EAAGC,IACnBC,GAAO,IAER,OAAOA,CACR,CAcA,SAASC,EAASC,EAAKC,EAAOC,GAC7B,IAAIC,GAAW,EACXC,EAAMH,EAAQD,EAAIK,OACtB,OAAKD,EAAM,IAnCZ,SAA0BJ,GACzB,MAAoB,MAAbA,EAAK,EACb,CAoCMM,CAAiBN,KACrBG,GAAW,EACXH,EAAMA,EAAIO,OAAQ,IAEnBP,EAAM,EACLA,EAAML,EAAOS,GACbT,EAAOS,GAAQJ,EACXG,IACJH,EAAM,IAAMA,IAVLA,CAaT,CCpDA,IAAIQ,EAAYC,OAAOC,UAAUC,YAC7BC,EAAYH,OAAOC,UAAUG,YAajC,SAASC,EAAeC,GACvB,IAAIC,EACAlB,EACAD,EAEJ,OAASkB,EAAME,WACf,IAAK,IAEJD,EAAO,EACP,MACD,IAAK,IAEJA,EAAO,EACP,MACD,IAAK,IACL,IAAK,IAEJA,EAAO,GACP,MAID,QAECA,EAAO,GAKR,GAFAlB,EAAMiB,EAAMG,IACZrB,EAAIsB,SAAUrB,EAAK,KACbsB,SAAUvB,GAAM,CACrB,IAAMJ,EAAUK,GACf,MAAM,IAAIuB,MAAO,2BAA6BvB,GAE/CD,EAAI,CACJ,CAkCD,OAjCKA,EAAI,IAA2B,MAApBkB,EAAME,WAA8B,KAATD,KAC1CnB,EAAI,WAAaA,EAAI,GAEjBA,EAAI,GACRC,IAASD,GAAIyB,SAAUN,GAClBD,EAAM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,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,237,238,239,240,241,242,243,244,245,246]}
\ No newline at end of file
diff --git a/lib/index.js b/lib/index.js
deleted file mode 100644
index 5adbf8c..0000000
--- a/lib/index.js
+++ /dev/null
@@ -1,330 +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 ns
-*/
-var ns = {};
-
-/**
-* @name anyByAsync
-* @memberof ns
-* @readonly
-* @type {Function}
-* @see {@link module:@stdlib/utils/async/any-by}
-*/
-setReadOnly( ns, 'anyByAsync', require( '@stdlib/utils-async-any-by' ) );
-
-/**
-* @name anyByRightAsync
-* @memberof ns
-* @readonly
-* @type {Function}
-* @see {@link module:@stdlib/utils/async/any-by-right}
-*/
-setReadOnly( ns, 'anyByRightAsync', require( '@stdlib/utils-async-any-by-right' ) );
-
-/**
-* @name bifurcateByAsync
-* @memberof ns
-* @readonly
-* @type {Function}
-* @see {@link module:@stdlib/utils/async/bifurcate-by}
-*/
-setReadOnly( ns, 'bifurcateByAsync', require( '@stdlib/utils-async-bifurcate-by' ) );
-
-/**
-* @name composeAsync
-* @memberof ns
-* @readonly
-* @type {Function}
-* @see {@link module:@stdlib/utils/async/compose}
-*/
-setReadOnly( ns, 'composeAsync', require( '@stdlib/utils-async-compose' ) );
-
-/**
-* @name countByAsync
-* @memberof ns
-* @readonly
-* @type {Function}
-* @see {@link module:@stdlib/utils/async/count-by}
-*/
-setReadOnly( ns, 'countByAsync', require( '@stdlib/utils-async-count-by' ) );
-
-/**
-* @name doUntilAsync
-* @memberof ns
-* @readonly
-* @type {Function}
-* @see {@link module:@stdlib/utils/async/do-until}
-*/
-setReadOnly( ns, 'doUntilAsync', require( '@stdlib/utils-async-do-until' ) );
-
-/**
-* @name doWhileAsync
-* @memberof ns
-* @readonly
-* @type {Function}
-* @see {@link module:@stdlib/utils/async/do-while}
-*/
-setReadOnly( ns, 'doWhileAsync', require( '@stdlib/utils-async-do-while' ) );
-
-/**
-* @name everyByAsync
-* @memberof ns
-* @readonly
-* @type {Function}
-* @see {@link module:@stdlib/utils/async/every-by}
-*/
-setReadOnly( ns, 'everyByAsync', require( '@stdlib/utils-async-every-by' ) );
-
-/**
-* @name everyByRightAsync
-* @memberof ns
-* @readonly
-* @type {Function}
-* @see {@link module:@stdlib/utils/async/every-by-right}
-*/
-setReadOnly( ns, 'everyByRightAsync', require( '@stdlib/utils-async-every-by-right' ) );
-
-/**
-* @name forEachAsync
-* @memberof ns
-* @readonly
-* @type {Function}
-* @see {@link module:@stdlib/utils/async/for-each}
-*/
-setReadOnly( ns, 'forEachAsync', require( '@stdlib/utils-async-for-each' ) );
-
-/**
-* @name forEachRightAsync
-* @memberof ns
-* @readonly
-* @type {Function}
-* @see {@link module:@stdlib/utils/async/for-each-right}
-*/
-setReadOnly( ns, 'forEachRightAsync', require( '@stdlib/utils-async-for-each-right' ) );
-
-/**
-* @name functionSequenceAsync
-* @memberof ns
-* @readonly
-* @type {Function}
-* @see {@link module:@stdlib/utils/async/function-sequence}
-*/
-setReadOnly( ns, 'functionSequenceAsync', require( '@stdlib/utils-async-function-sequence' ) );
-
-/**
-* @name groupByAsync
-* @memberof ns
-* @readonly
-* @type {Function}
-* @see {@link module:@stdlib/utils/async/group-by}
-*/
-setReadOnly( ns, 'groupByAsync', require( '@stdlib/utils-async-group-by' ) );
-
-/**
-* @name ifelseAsync
-* @memberof ns
-* @readonly
-* @type {Function}
-* @see {@link module:@stdlib/utils/async/if-else}
-*/
-setReadOnly( ns, 'ifelseAsync', require( '@stdlib/utils-async-if-else' ) );
-
-/**
-* @name ifthenAsync
-* @memberof ns
-* @readonly
-* @type {Function}
-* @see {@link module:@stdlib/utils/async/if-then}
-*/
-setReadOnly( ns, 'ifthenAsync', require( '@stdlib/utils-async-if-then' ) );
-
-/**
-* @name inmapAsync
-* @memberof ns
-* @readonly
-* @type {Function}
-* @see {@link module:@stdlib/utils/async/inmap}
-*/
-setReadOnly( ns, 'inmapAsync', require( '@stdlib/utils-async-inmap' ) );
-
-/**
-* @name inmapRightAsync
-* @memberof ns
-* @readonly
-* @type {Function}
-* @see {@link module:@stdlib/utils/async/inmap-right}
-*/
-setReadOnly( ns, 'inmapRightAsync', require( '@stdlib/utils-async-inmap-right' ) );
-
-/**
-* @name mapFunAsync
-* @memberof ns
-* @readonly
-* @type {Function}
-* @see {@link module:@stdlib/utils/async/map-function}
-*/
-setReadOnly( ns, 'mapFunAsync', require( '@stdlib/utils-async-map-function' ) );
-
-/**
-* @name mapKeysAsync
-* @memberof ns
-* @readonly
-* @type {Function}
-* @see {@link module:@stdlib/utils/async/map-keys}
-*/
-setReadOnly( ns, 'mapKeysAsync', require( '@stdlib/utils-async-map-keys' ) );
-
-/**
-* @name mapValuesAsync
-* @memberof ns
-* @readonly
-* @type {Function}
-* @see {@link module:@stdlib/utils/async/map-values}
-*/
-setReadOnly( ns, 'mapValuesAsync', require( '@stdlib/utils-async-map-values' ) );
-
-/**
-* @name noneByAsync
-* @memberof ns
-* @readonly
-* @type {Function}
-* @see {@link module:@stdlib/utils/async/none-by}
-*/
-setReadOnly( ns, 'noneByAsync', require( '@stdlib/utils-async-none-by' ) );
-
-/**
-* @name noneByRightAsync
-* @memberof ns
-* @readonly
-* @type {Function}
-* @see {@link module:@stdlib/utils/async/none-by-right}
-*/
-setReadOnly( ns, 'noneByRightAsync', require( '@stdlib/utils-async-none-by-right' ) );
-
-/**
-* @name reduceAsync
-* @memberof ns
-* @readonly
-* @type {Function}
-* @see {@link module:@stdlib/utils/async/reduce}
-*/
-setReadOnly( ns, 'reduceAsync', require( '@stdlib/utils-async-reduce' ) );
-
-/**
-* @name reduceRightAsync
-* @memberof ns
-* @readonly
-* @type {Function}
-* @see {@link module:@stdlib/utils/async/reduce-right}
-*/
-setReadOnly( ns, 'reduceRightAsync', require( '@stdlib/utils-async-reduce-right' ) );
-
-/**
-* @name waterfall
-* @memberof ns
-* @readonly
-* @type {Function}
-* @see {@link module:@stdlib/utils/async/series-waterfall}
-*/
-setReadOnly( ns, 'waterfall', require( '@stdlib/utils-async-series-waterfall' ) );
-
-/**
-* @name someByAsync
-* @memberof ns
-* @readonly
-* @type {Function}
-* @see {@link module:@stdlib/utils/async/some-by}
-*/
-setReadOnly( ns, 'someByAsync', require( '@stdlib/utils-async-some-by' ) );
-
-/**
-* @name someByRightAsync
-* @memberof ns
-* @readonly
-* @type {Function}
-* @see {@link module:@stdlib/utils/async/some-by-right}
-*/
-setReadOnly( ns, 'someByRightAsync', require( '@stdlib/utils-async-some-by-right' ) );
-
-/**
-* @name tabulateByAsync
-* @memberof ns
-* @readonly
-* @type {Function}
-* @see {@link module:@stdlib/utils/async/tabulate-by}
-*/
-setReadOnly( ns, 'tabulateByAsync', require( '@stdlib/utils-async-tabulate-by' ) );
-
-/**
-* @name trycatchAsync
-* @memberof ns
-* @readonly
-* @type {Function}
-* @see {@link module:@stdlib/utils/async/try-catch}
-*/
-setReadOnly( ns, 'trycatchAsync', require( '@stdlib/utils-async-try-catch' ) );
-
-/**
-* @name trythenAsync
-* @memberof ns
-* @readonly
-* @type {Function}
-* @see {@link module:@stdlib/utils/async/try-then}
-*/
-setReadOnly( ns, 'trythenAsync', require( '@stdlib/utils-async-try-then' ) );
-
-/**
-* @name untilAsync
-* @memberof ns
-* @readonly
-* @type {Function}
-* @see {@link module:@stdlib/utils/async/until}
-*/
-setReadOnly( ns, 'untilAsync', require( '@stdlib/utils-async-until' ) );
-
-/**
-* @name whileAsync
-* @memberof ns
-* @readonly
-* @type {Function}
-* @see {@link module:@stdlib/utils/async/while}
-*/
-setReadOnly( ns, 'whileAsync', require( '@stdlib/utils-async-while' ) );
-
-
-// EXPORTS //
-
-module.exports = ns;
diff --git a/package.json b/package.json
index 22af941..3521977 100644
--- a/package.json
+++ b/package.json
@@ -3,30 +3,7 @@
"version": "0.3.0",
"description": "Standard async utilities.",
"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/index.js",
- "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,86 +12,6 @@
"bugs": {
"url": "https://github.com/stdlib-js/stdlib/issues"
},
- "dependencies": {
- "@stdlib/utils-async-any-by": "^0.2.2",
- "@stdlib/utils-async-any-by-right": "^0.2.2",
- "@stdlib/utils-async-bifurcate-by": "^0.2.2",
- "@stdlib/utils-async-compose": "^0.2.2",
- "@stdlib/utils-async-count-by": "^0.2.2",
- "@stdlib/utils-async-do-until": "^0.2.2",
- "@stdlib/utils-async-do-while": "^0.2.2",
- "@stdlib/utils-async-every-by": "^0.2.2",
- "@stdlib/utils-async-every-by-right": "^0.2.2",
- "@stdlib/utils-async-for-each": "^0.2.2",
- "@stdlib/utils-async-for-each-right": "^0.2.2",
- "@stdlib/utils-async-function-sequence": "^0.2.2",
- "@stdlib/utils-async-group-by": "^0.2.2",
- "@stdlib/utils-async-if-else": "^0.2.2",
- "@stdlib/utils-async-if-then": "^0.2.2",
- "@stdlib/utils-async-inmap": "^0.2.2",
- "@stdlib/utils-async-inmap-right": "^0.2.2",
- "@stdlib/utils-async-map-function": "^0.2.2",
- "@stdlib/utils-async-map-keys": "^0.2.2",
- "@stdlib/utils-async-map-values": "^0.2.2",
- "@stdlib/utils-async-none-by": "^0.2.2",
- "@stdlib/utils-async-none-by-right": "^0.2.2",
- "@stdlib/utils-async-reduce": "^0.2.2",
- "@stdlib/utils-async-reduce-right": "^0.2.2",
- "@stdlib/utils-async-series-waterfall": "^0.2.2",
- "@stdlib/utils-async-some-by": "^0.2.2",
- "@stdlib/utils-async-some-by-right": "^0.2.2",
- "@stdlib/utils-async-tabulate-by": "^0.2.2",
- "@stdlib/utils-async-try-catch": "^0.2.2",
- "@stdlib/utils-async-try-then": "^0.2.2",
- "@stdlib/utils-async-until": "^0.2.2",
- "@stdlib/utils-async-while": "^0.2.2",
- "@stdlib/utils-define-read-only-property": "^0.2.2"
- },
- "devDependencies": {
- "@stdlib/assert-has-own-property": "^0.2.2",
- "@stdlib/assert-is-array": "^0.2.2",
- "@stdlib/assert-is-boolean": "^0.2.2",
- "@stdlib/assert-is-collection": "^0.2.2",
- "@stdlib/assert-is-function": "^0.2.2",
- "@stdlib/assert-is-function-array": "^0.2.2",
- "@stdlib/assert-is-nan": "^0.2.2",
- "@stdlib/assert-is-nonnegative-integer": "^0.2.2",
- "@stdlib/assert-is-plain-object": "^0.2.2",
- "@stdlib/assert-is-positive-integer": "^0.2.2",
- "@stdlib/constants-float64-eps": "^0.2.2",
- "@stdlib/constants-float64-pinf": "^0.2.2",
- "@stdlib/fs-read-file": "^0.2.2",
- "@stdlib/math-base-assert-is-nan": "^0.2.2",
- "@stdlib/math-base-special-ceil": "^0.2.2",
- "@stdlib/random-base-randu": "^0.2.1",
- "@stdlib/string-format": "^0.2.2",
- "@stdlib/string-repeat": "^0.2.2",
- "@stdlib/string-replace": "^0.2.2",
- "@stdlib/utils-async-parallel": "^0.1.0",
- "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2",
- "@stdlib/utils-index-of": "^0.2.2",
- "@stdlib/utils-keys": "^0.2.2",
- "@stdlib/utils-noop": "^0.2.2",
- "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",
"stdutil",
diff --git a/stats_browser.html b/stats_browser.html
new file mode 100644
index 0000000..83bc5fd
--- /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..1121285
--- /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 af176bc..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 ns = require( './../lib' );
-
-
-// TESTS //
-
-tape( 'main export is an object', function test( t ) {
- t.ok( true, __filename );
- t.strictEqual( typeof ns, 'object', 'main export is an object' );
- t.end();
-});
-
-tape( 'the exported object contains async utilities', function test( t ) {
- var keys = objectKeys( ns );
- t.equal( keys.length > 0, true, 'has keys' );
- t.end();
-});