diff --git a/.editorconfig b/.editorconfig
deleted file mode 100644
index 0779e8a..0000000
--- a/.editorconfig
+++ /dev/null
@@ -1,181 +0,0 @@
-#/
-# @license Apache-2.0
-#
-# Copyright (c) 2017 The Stdlib Authors.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#/
-
-# EditorConfig configuration file (see ).
-
-# Indicate that this file is a root-level configuration file:
-root = true
-
-# Set properties for all files:
-[*]
-end_of_line = lf
-charset = utf-8
-trim_trailing_whitespace = true
-insert_final_newline = true
-
-# Set properties for JavaScript files:
-[*.{js,js.txt}]
-indent_style = tab
-
-# Set properties for JavaScript ES module files:
-[*.{mjs,mjs.txt}]
-indent_style = tab
-
-# Set properties for JavaScript CommonJS files:
-[*.{cjs,cjs.txt}]
-indent_style = tab
-
-# Set properties for JSON files:
-[*.{json,json.txt}]
-indent_style = space
-indent_size = 2
-
-# Set properties for `cli_opts.json` files:
-[cli_opts.json]
-indent_style = tab
-
-# Set properties for TypeScript files:
-[*.ts]
-indent_style = tab
-
-# Set properties for Python files:
-[*.{py,py.txt}]
-indent_style = space
-indent_size = 4
-
-# Set properties for Julia files:
-[*.{jl,jl.txt}]
-indent_style = tab
-
-# Set properties for R files:
-[*.{R,R.txt}]
-indent_style = tab
-
-# Set properties for C files:
-[*.{c,c.txt}]
-indent_style = tab
-
-# Set properties for C header files:
-[*.{h,h.txt}]
-indent_style = tab
-
-# Set properties for C++ files:
-[*.{cpp,cpp.txt}]
-indent_style = tab
-
-# Set properties for C++ header files:
-[*.{hpp,hpp.txt}]
-indent_style = tab
-
-# Set properties for Fortran files:
-[*.{f,f.txt}]
-indent_style = space
-indent_size = 2
-insert_final_newline = false
-
-# Set properties for shell files:
-[*.{sh,sh.txt}]
-indent_style = tab
-
-# Set properties for AWK files:
-[*.{awk,awk.txt}]
-indent_style = tab
-
-# Set properties for HTML files:
-[*.{html,html.txt}]
-indent_style = tab
-tab_width = 2
-
-# Set properties for XML files:
-[*.{xml,xml.txt}]
-indent_style = tab
-tab_width = 2
-
-# Set properties for CSS files:
-[*.{css,css.txt}]
-indent_style = tab
-
-# Set properties for Makefiles:
-[Makefile]
-indent_style = tab
-
-[*.{mk,mk.txt}]
-indent_style = tab
-
-# Set properties for Markdown files:
-[*.{md,md.txt}]
-indent_style = space
-indent_size = 4
-trim_trailing_whitespace = true # Note: this disables using two spaces to force a hard line break, which is permitted in Markdown. As we don't typically follow that practice (TMK), we should be safe to automatically trim.
-
-# Set properties for `usage.txt` files:
-[usage.txt]
-indent_style = space
-indent_size = 2
-
-# Set properties for `repl.txt` files:
-[repl.txt]
-indent_style = space
-indent_size = 4
-
-# Set properties for `package.json` files:
-[package.{json,json.txt}]
-indent_style = space
-indent_size = 2
-
-# Set properties for `datapackage.json` files:
-[datapackage.json]
-indent_style = space
-indent_size = 2
-
-# Set properties for `manifest.json` files:
-[manifest.json]
-indent_style = space
-indent_size = 2
-
-# Set properties for `tsconfig.json` files:
-[tsconfig.json]
-indent_style = space
-indent_size = 2
-
-# Set properties for LaTeX files:
-[*.{tex,tex.txt}]
-indent_style = tab
-
-# Set properties for LaTeX Bibliography files:
-[*.{bib,bib.txt}]
-indent_style = tab
-
-# Set properties for YAML files:
-[*.{yml,yml.txt}]
-indent_style = space
-indent_size = 2
-
-# Set properties for GYP files:
-[binding.gyp]
-indent_style = space
-indent_size = 2
-
-[*.gypi]
-indent_style = space
-indent_size = 2
-
-# Set properties for citation files:
-[*.{cff,cff.txt}]
-indent_style = space
-indent_size = 2
diff --git a/.eslintrc.js b/.eslintrc.js
deleted file mode 100644
index 5f30286..0000000
--- a/.eslintrc.js
+++ /dev/null
@@ -1 +0,0 @@
-/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */
diff --git a/.gitattributes b/.gitattributes
deleted file mode 100644
index 1c88e69..0000000
--- a/.gitattributes
+++ /dev/null
@@ -1,66 +0,0 @@
-#/
-# @license Apache-2.0
-#
-# Copyright (c) 2017 The Stdlib Authors.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#/
-
-# Configuration file which assigns attributes to pathnames.
-#
-# [1]: https://git-scm.com/docs/gitattributes
-
-# Automatically normalize the line endings of any committed text files:
-* text=auto
-
-# Override line endings for certain files on checkout:
-*.crlf.csv text eol=crlf
-
-# Denote that certain files are binary and should not be modified:
-*.png binary
-*.jpg binary
-*.jpeg binary
-*.gif binary
-*.ico binary
-*.gz binary
-*.zip binary
-*.7z binary
-*.mp3 binary
-*.mp4 binary
-*.mov binary
-
-# Override what is considered "vendored" by GitHub's linguist:
-/lib/node_modules/** -linguist-vendored -linguist-generated
-
-# Configure directories which should *not* be included in GitHub language statistics:
-/deps/** linguist-vendored
-/dist/** linguist-generated
-/workshops/** linguist-vendored
-
-benchmark/** linguist-vendored
-docs/* linguist-documentation
-etc/** linguist-vendored
-examples/** linguist-documentation
-scripts/** linguist-vendored
-test/** linguist-vendored
-tools/** linguist-vendored
-
-# Configure files which should *not* be included in GitHub language statistics:
-Makefile linguist-vendored
-*.mk linguist-vendored
-*.jl linguist-vendored
-*.py linguist-vendored
-*.R linguist-vendored
-
-# Configure files which should be included in GitHub language statistics:
-docs/types/*.d.ts -linguist-documentation
diff --git a/.github/.keepalive b/.github/.keepalive
deleted file mode 100644
index 0d5d23b..0000000
--- a/.github/.keepalive
+++ /dev/null
@@ -1 +0,0 @@
-2024-12-30T02:08:19.949Z
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
deleted file mode 100644
index 94022e5..0000000
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/flatten2d-by) 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 43bada2..0000000
--- a/.github/workflows/close_pull_requests.yml
+++ /dev/null
@@ -1,54 +0,0 @@
-#/
-# @license Apache-2.0
-#
-# Copyright (c) 2021 The Stdlib Authors.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#/
-
-# Workflow name:
-name: close_pull_requests
-
-# Workflow triggers:
-on:
- pull_request_target:
- types: [opened]
-
-# Workflow jobs:
-jobs:
-
- # Define job to close all pull requests:
- run:
-
- # Define the type of virtual host machine on which to run the job:
- runs-on: ubuntu-latest
-
- # Define the sequence of job steps...
- steps:
-
- # Close pull request
- - name: 'Close pull request'
- # Pin action to full length commit SHA corresponding to v3.1.2
- uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448
- with:
- comment: |
- Thank you for submitting a pull request. :raised_hands:
-
- We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib).
-
- We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/flatten2d-by) 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 a52f914..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: '2 14 * * 2'
-
- # Allow the workflow to be manually run:
- workflow_dispatch:
-
-# Workflow jobs:
-jobs:
-
- # Define a job for retrieving npm download counts...
- npm_downloads:
-
- # Define display name:
- name: 'Retrieve npm download counts'
-
- # Define the type of virtual host machine on which to run the job:
- runs-on: ubuntu-latest
-
- # Define the sequence of job steps...
- steps:
- # Checkout the repository:
- - name: 'Checkout repository'
- # Pin action to full length commit SHA
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
- timeout-minutes: 10
-
- # Install Node.js:
- - name: 'Install Node.js'
- # Pin action to full length commit SHA
- uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1
- with:
- node-version: 20
- timeout-minutes: 5
-
- # Resolve package name:
- - name: 'Resolve package name'
- id: package_name
- run: |
- name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'`
- echo "package_name=$name" >> $GITHUB_OUTPUT
- timeout-minutes: 5
-
- # Fetch download data:
- - name: 'Fetch data'
- id: download_data
- run: |
- url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}"
- echo "$url"
- data=$(curl "$url")
- mkdir ./tmp
- echo "$data" > ./tmp/npm_downloads.json
- echo "data=$data" >> $GITHUB_OUTPUT
- timeout-minutes: 5
-
- # Print summary of download data:
- - name: 'Print summary'
- run: |
- echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY
- echo "|------|------------|" >> $GITHUB_STEP_SUMMARY
- cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY
-
- # Upload the download data:
- - name: 'Upload data'
- # Pin action to full length commit SHA
- uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
- with:
- # Define a name for the uploaded artifact (ensuring a unique name for each job):
- name: npm_downloads
-
- # Specify the path to the file to upload:
- path: ./tmp/npm_downloads.json
-
- # Specify the number of days to retain the artifact (default is 90 days):
- retention-days: 90
- timeout-minutes: 10
- if: success()
-
- # Send data to events server:
- - name: 'Post data'
- # Pin action to full length commit SHA
- uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3
- env:
- webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }}
- webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }}
- data: '{ "downloads": ${{ steps.download_data.outputs.data }} }'
- timeout-minutes: 5
- if: success()
diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml
deleted file mode 100644
index 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 flatten2dBy = require( '@stdlib/array-base-flatten2d-by' );
+If no recognized module system is present, access bundle contents via the global scope:
+
+```html
+
```
#### flatten2dBy( x, shape, colexicographic, clbk\[, thisArg] )
@@ -165,10 +171,15 @@ y = flatten2dBy.assign( x, [ 2, 2 ], true, out, 1, 0, scale );
-```javascript
-var naryFunction = require( '@stdlib/utils-nary-function' );
-var abs = require( '@stdlib/math-base-special-abs' );
-var flatten2dBy = require( '@stdlib/array-base-flatten2d-by' );
+```html
+
+
+
+
+
+
+
+
+
```
@@ -302,7 +318,7 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
-[@stdlib/array/base/flatten2d]: https://github.com/stdlib-js/array-base-flatten2d
+[@stdlib/array/base/flatten2d]: https://github.com/stdlib-js/array-base-flatten2d/tree/umd
diff --git a/SECURITY.md b/SECURITY.md
deleted file mode 100644
index 9702d4c..0000000
--- a/SECURITY.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# Security
-
-> Policy for reporting security vulnerabilities.
-
-See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security).
diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js
deleted file mode 100644
index a054e0d..0000000
--- a/benchmark/benchmark.js
+++ /dev/null
@@ -1,143 +0,0 @@
-/**
-* @license Apache-2.0
-*
-* Copyright (c) 2023 The Stdlib Authors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-'use strict';
-
-// MODULES //
-
-var bench = require( '@stdlib/bench-harness' );
-var isArray = require( '@stdlib/assert-is-array' );
-var isFloat64Array = require( '@stdlib/assert-is-float64array' );
-var zeroTo = require( '@stdlib/array-base-zero-to' );
-var filled = require( '@stdlib/array-base-filled' );
-var Float64Array = require( '@stdlib/array-float64' );
-var pkg = require( './../package.json' ).name;
-var flatten2dBy = require( './../lib' );
-
-
-// FUNCTIONS //
-
-/**
-* Scales an input value.
-*
-* @private
-* @param {number} v - input value
-* @returns {number} output value
-*
-* @example
-* var v = scale( 2.0 );
-* // returns 4.0
-*/
-function scale( v ) {
- return v * 2.0;
-}
-
-
-// MAIN //
-
-bench( pkg+':size=100,lexicographic', function benchmark( b ) {
- var x;
- var i;
- var v;
-
- x = filled( zeroTo( 10 ), 10 );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = flatten2dBy( x, [ 10, 10 ], false, scale );
- if ( typeof v !== 'object' ) {
- b.fail( 'should return an array' );
- }
- }
- b.toc();
- if ( !isArray( v ) ) {
- b.fail( 'should return an array' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+':size=100,colexicographic', function benchmark( b ) {
- var x;
- var i;
- var v;
-
- x = filled( zeroTo( 10 ), 10 );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = flatten2dBy( x, [ 10, 10 ], true, scale );
- if ( typeof v !== 'object' ) {
- b.fail( 'should return an array' );
- }
- }
- b.toc();
- if ( !isArray( v ) ) {
- b.fail( 'should return an array' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+':assign:size=100,lexicographic', function benchmark( b ) {
- var out;
- var x;
- var i;
- var v;
-
- out = new Float64Array( 100 );
- x = filled( zeroTo( 10 ), 10 );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = flatten2dBy.assign( x, [ 10, 10 ], false, out, 1, 0, scale );
- if ( typeof v !== 'object' ) {
- b.fail( 'should return a Float64Array' );
- }
- }
- b.toc();
- if ( !isFloat64Array( v ) ) {
- b.fail( 'should return a Float64Array' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
-
-bench( pkg+':assign:size=100,colexicographic', function benchmark( b ) {
- var out;
- var x;
- var i;
- var v;
-
- out = new Float64Array( 100 );
- x = filled( zeroTo( 10 ), 10 );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- v = flatten2dBy.assign( x, [ 10, 10 ], true, out, 1, 0, scale );
- if ( typeof v !== 'object' ) {
- b.fail( 'should return a Float64Array' );
- }
- }
- b.toc();
- if ( !isFloat64Array( v ) ) {
- b.fail( 'should return a Float64Array' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
diff --git a/branches.md b/branches.md
deleted file mode 100644
index bebe5f7..0000000
--- a/branches.md
+++ /dev/null
@@ -1,56 +0,0 @@
-
-
-# Branches
-
-This repository has the following branches:
-
-- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place.
-- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network).
-- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]).
-- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]).
-- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]).
-
-The following diagram illustrates the relationships among the above branches:
-
-```mermaid
-graph TD;
-A[stdlib]-->|generate standalone package|B;
-B[main] -->|productionize| C[production];
-C -->|bundle| D[esm];
-C -->|bundle| E[deno];
-C -->|bundle| F[umd];
-
-%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/flatten2d-by"
-%% click B href "https://github.com/stdlib-js/array-base-flatten2d-by/tree/main"
-%% click C href "https://github.com/stdlib-js/array-base-flatten2d-by/tree/production"
-%% click D href "https://github.com/stdlib-js/array-base-flatten2d-by/tree/esm"
-%% click E href "https://github.com/stdlib-js/array-base-flatten2d-by/tree/deno"
-%% click F href "https://github.com/stdlib-js/array-base-flatten2d-by/tree/umd"
-```
-
-[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/flatten2d-by
-[production-url]: https://github.com/stdlib-js/array-base-flatten2d-by/tree/production
-[deno-url]: https://github.com/stdlib-js/array-base-flatten2d-by/tree/deno
-[deno-readme]: https://github.com/stdlib-js/array-base-flatten2d-by/blob/deno/README.md
-[umd-url]: https://github.com/stdlib-js/array-base-flatten2d-by/tree/umd
-[umd-readme]: https://github.com/stdlib-js/array-base-flatten2d-by/blob/umd/README.md
-[esm-url]: https://github.com/stdlib-js/array-base-flatten2d-by/tree/esm
-[esm-readme]: https://github.com/stdlib-js/array-base-flatten2d-by/blob/esm/README.md
\ No newline at end of file
diff --git a/browser.js b/browser.js
new file mode 100644
index 0000000..218e459
--- /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,r;e=this,r=function(){"use strict";var e="function"==typeof Object.defineProperty?Object.defineProperty:null,r=Object.defineProperty;function i(e){return"number"==typeof e}function t(e){var r,i="";for(r=0;r0&&(r-=1),t=a.toExponential(r)):t=a.toPrecision(e.precision),e.alternate||(t=f.call(t,v,"$1e"),t=f.call(t,b,"e"),t=f.call(t,w,""));break;default:throw new Error("invalid double notation. Value: "+e.specifier)}return t=f.call(t,u,"e+0$1"),t=f.call(t,g,"e-0$1"),e.alternate&&(t=f.call(t,d,"$1."),t=f.call(t,h,"$1.e")),a>=0&&e.sign&&(t=e.sign+t),t=e.specifier===p.call(e.specifier)?p.call(t):l.call(t)}function m(e){var r,i="";for(r=0;r127)throw new Error("invalid character code. Value: "+t.arg);t.arg=k(o)?String(t.arg):_(o)}break;case"e":case"E":case"f":case"F":case"g":case"G":r||(t.precision=6),t.arg=y(t);break;default:throw new Error("invalid specifier: "+t.specifier)}t.maxWidth>=0&&t.arg.length>t.maxWidth&&(t.arg=t.arg.substring(0,t.maxWidth)),t.padZeros?t.arg=a(t.arg,t.width||t.precision,t.padRight):t.width&&(t.arg=(u=t.arg,g=t.width,d=t.padRight,h=void 0,(h=g-u.length)<0?u:u=d?u+m(h):m(h)+u)),c+=t.arg||"",l+=1}return c}var j=/%(?:([1-9]\d*)\$)?([0 +\-#]*)(\*|\d+)?(?:(\.)(\*|\d+)?)?[hlL]?([%A-Za-z])/g;function V(e){var r={mapping:e[1]?parseInt(e[1],10):void 0,flags:e[2],width:e[3],precision:e[5],specifier:e[6]};return"."===e[4]&&void 0===e[5]&&(r.precision="1"),r}function T(e){var r,i,t,a;for(i=[],a=0,t=j.exec(e);t;)(r=e.slice(a,j.lastIndex-t[0].length)).length&&i.push(r),i.push(V(t)),a=j.lastIndex,t=j.exec(e);return(r=e.slice(a)).length&&i.push(r),i}function $(e){var r,i;if("string"!=typeof e)throw new TypeError($("invalid argument. First argument must be a string. Value: `%s`.",e));for(r=[T(e)],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) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Flattens a two-dimensional nested array according to a callback function.\n*\n* ## Notes\n*\n* - The function assumes that all nested arrays have the same length (i.e., the input array is **not** a ragged array).\n*\n* @param {Array} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {boolean} colexicographic - specifies whether to flatten array values in colexicographic order\n* @param {Function} clbk - callback function\n* @param {*} [thisArg] - callback execution context\n* @returns {Array} flattened array\n*\n* @example\n* function scale( v ) {\n* return v * 2;\n* }\n*\n* var x = [ [ 1, 2 ], [ 3, 4 ] ];\n*\n* var out = flatten2dBy( x, [ 2, 2 ], false, scale );\n* // returns [ 2, 4, 6, 8 ]\n*\n* @example\n* function scale( v ) {\n* return v * 2;\n* }\n*\n* var x = [ [ 1, 2 ], [ 3, 4 ] ];\n*\n* var out = flatten2dBy( x, [ 2, 2 ], true, scale );\n* // returns [ 2, 6, 4, 8 ]\n*/\nfunction flatten2dBy( x, shape, colexicographic, clbk, thisArg ) {\n\tvar out;\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar a0;\n\n\t// Extract loop variables:\n\tS0 = shape[ 1 ]; // for nested arrays, the last dimensions have the fastest changing indices\n\tS1 = shape[ 0 ];\n\n\t// Initialize an output array:\n\tout = [];\n\n\t// Iterate over the array dimensions...\n\tif ( colexicographic ) {\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\tout.push( clbk.call( thisArg, x[ i1 ][ i0 ], [ i1, i0 ], x ) ); // equivalent to storing in column-major (Fortran-style) order\n\t\t\t}\n\t\t}\n\t\treturn out;\n\t}\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\ta0 = x[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tout.push( clbk.call( thisArg, a0[ i0 ], [ i1, i0 ], x ) ); // equivalent to storing in row-major (C-style) order\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default flatten2dBy;\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) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Flatten a two-dimensional nested array according to a callback function.\n*\n* @module @stdlib/array-base-flatten2d-by\n*\n* @example\n* import flatten2dBy from '@stdlib/array-base-flatten2d-by';\n*\n* function scale( v ) {\n* return v * 2;\n* }\n*\n* var x = [ [ 1, 2 ], [ 3, 4 ] ];\n*\n* var out = flatten2dBy( x, [ 2, 2 ], false, scale );\n* // returns [ 2, 4, 6, 8 ]\n*\n* @example\n* import flatten2dBy from '@stdlib/array-base-flatten2d-by';\n*\n* function scale( v ) {\n* return v * 2;\n* }\n*\n* var x = [ [ 1, 2 ], [ 3, 4 ] ];\n*\n* var out = flatten2dBy( x, [ 2, 2 ], true, scale );\n* // returns [ 2, 6, 4, 8 ]\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n* import flatten2dBy from '@stdlib/array-base-flatten2d-by';\n*\n* function scale( v ) {\n* return v * 2;\n* }\n*\n* var x = [ [ 1, 2 ], [ 3, 4 ] ];\n*\n* var out = new Float64Array( 4 );\n* var y = flatten2dBy( x, [ 2, 2 ], true, out, 1, 0, scale );\n* // returns [ 2, 6, 4, 8 ]\n*\n* var bool = ( y === out );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport 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) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Flattens a two-dimensional nested array according to a callback function and assigns elements to a provided output array.\n*\n* ## Notes\n*\n* - The function assumes that all nested arrays have the same length (i.e., the input array is **not** a ragged array).\n*\n* @param {Array} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {boolean} colexicographic - specifies whether to flatten array values in colexicographic order\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @param {Function} clbk - callback function\n* @param {*} [thisArg] - callback execution context\n* @returns {Collection} output array\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* function scale( v ) {\n* return v * 2;\n* }\n*\n* var x = [ [ 1, 2 ], [ 3, 4 ] ];\n*\n* var out = flatten2dBy( x, [ 2, 2 ], false, new Float64Array( 4 ), 1, 0, scale );\n* // returns [ 2, 4, 6, 8 ]\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* function scale( v ) {\n* return v * 2;\n* }\n*\n* var x = [ [ 1, 2 ], [ 3, 4 ] ];\n*\n* var out = flatten2dBy( x, [ 2, 2 ], true, new Float64Array( 4 ), 1, 0, scale );\n* // returns [ 2, 6, 4, 8 ]\n*/\nfunction flatten2dBy( x, shape, colexicographic, out, stride, offset, clbk, thisArg ) { // eslint-disable-line max-len\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar a0;\n\tvar io;\n\n\t// Extract loop variables:\n\tS0 = shape[ 1 ]; // for nested arrays, the last dimensions have the fastest changing indices\n\tS1 = shape[ 0 ];\n\n\t// Iterate over the array dimensions...\n\tio = offset;\n\tif ( colexicographic ) {\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\tout[ io ] = clbk.call( thisArg, x[ i1 ][ i0 ], [ i1, i0 ], x ); // equivalent to storing in column-major (Fortran-style) order\n\t\t\t\tio += stride;\n\t\t\t}\n\t\t}\n\t\treturn out;\n\t}\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\ta0 = x[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tout[ io ] = clbk.call( thisArg, a0[ i0 ], [ i1, i0 ], x ); // equivalent to storing in row-major (C-style) order\n\t\t\tio += stride;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default flatten2dBy;\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__","flatten2dBy","x","shape","colexicographic","clbk","thisArg","S0","S1","i0","i1","a0","err","hasDefinePropertySupport","builtin","obj","prop","descriptor","hasValue","hasGet","hasSet","__proto__","get","set","configurable","enumerable","writable","stride","offset","io"],"mappings":";yCAsBA,IAAIA,EAA0C,mBAA1BC,OAAOC,eAAkCD,OAAOC,eAAiB,KCiCjFA,EAAiBD,OAAOC,eCjB5B,SAASC,EAAUC,GAClB,MAA0B,iBAAVA,CACjB,CCAA,SAASC,EAAOC,GACf,IACIC,EADAC,EAAM,GAEV,IAAMD,EAAI,EAAGA,EAAID,EAAGC,IACnBC,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,EAAO,GAGZ0B,EAAKD,EACAxB,EAAkB,CACtB,IAAMK,EAAK,EAAGA,EAAKF,EAAIE,IACtB,IAAMC,EAAK,EAAGA,EAAKF,EAAIE,IACtBvG,EAAK0H,GAAOxB,EAAKrE,KAAMsE,EAASJ,EAAGQ,GAAMD,GAAM,CAAEC,EAAID,GAAMP,GAC3D2B,GAAMF,EAGR,OAAOxH,CACP,CACD,IAAMuG,EAAK,EAAGA,EAAKF,EAAIE,IAEtB,IADAC,EAAKT,EAAGQ,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBtG,EAAK0H,GAAOxB,EAAKrE,KAAMsE,EAASK,EAAIF,GAAM,CAAEC,EAAID,GAAMP,GACtD2B,GAAMF,EAGR,OAAOxH,CACR","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,15,17]}
\ No newline at end of file
diff --git a/dist/index.d.ts b/dist/index.d.ts
deleted file mode 100644
index fcb718d..0000000
--- a/dist/index.d.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-///
-import flatten2dBy from '../docs/types/index';
-export = flatten2dBy;
\ No newline at end of file
diff --git a/dist/index.js b/dist/index.js
deleted file mode 100644
index ec52113..0000000
--- a/dist/index.js
+++ /dev/null
@@ -1,7 +0,0 @@
-"use strict";var p=function(i,t){return function(){return t||i((t={exports:{}}).exports,t),t.exports}};var y=p(function(z,q){
-function O(i,t,c,f,s){var n,o,u,r,a,e;if(o=t[1],u=t[0],n=[],c){for(r=0;r} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {boolean} colexicographic - specifies whether to flatten array values in colexicographic order\n* @param {Function} clbk - callback function\n* @param {*} [thisArg] - callback execution context\n* @returns {Array} flattened array\n*\n* @example\n* function scale( v ) {\n* return v * 2;\n* }\n*\n* var x = [ [ 1, 2 ], [ 3, 4 ] ];\n*\n* var out = flatten2dBy( x, [ 2, 2 ], false, scale );\n* // returns [ 2, 4, 6, 8 ]\n*\n* @example\n* function scale( v ) {\n* return v * 2;\n* }\n*\n* var x = [ [ 1, 2 ], [ 3, 4 ] ];\n*\n* var out = flatten2dBy( x, [ 2, 2 ], true, scale );\n* // returns [ 2, 6, 4, 8 ]\n*/\nfunction flatten2dBy( x, shape, colexicographic, clbk, thisArg ) {\n\tvar out;\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar a0;\n\n\t// Extract loop variables:\n\tS0 = shape[ 1 ]; // for nested arrays, the last dimensions have the fastest changing indices\n\tS1 = shape[ 0 ];\n\n\t// Initialize an output array:\n\tout = [];\n\n\t// Iterate over the array dimensions...\n\tif ( colexicographic ) {\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\tout.push( clbk.call( thisArg, x[ i1 ][ i0 ], [ i1, i0 ], x ) ); // equivalent to storing in column-major (Fortran-style) order\n\t\t\t}\n\t\t}\n\t\treturn out;\n\t}\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\ta0 = x[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tout.push( clbk.call( thisArg, a0[ i0 ], [ i1, i0 ], x ) ); // equivalent to storing in row-major (C-style) order\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = flatten2dBy;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Flattens a two-dimensional nested array according to a callback function and assigns elements to a provided output array.\n*\n* ## Notes\n*\n* - The function assumes that all nested arrays have the same length (i.e., the input array is **not** a ragged array).\n*\n* @param {Array} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {boolean} colexicographic - specifies whether to flatten array values in colexicographic order\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @param {Function} clbk - callback function\n* @param {*} [thisArg] - callback execution context\n* @returns {Collection} output array\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* function scale( v ) {\n* return v * 2;\n* }\n*\n* var x = [ [ 1, 2 ], [ 3, 4 ] ];\n*\n* var out = flatten2dBy( x, [ 2, 2 ], false, new Float64Array( 4 ), 1, 0, scale );\n* // returns [ 2, 4, 6, 8 ]\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* function scale( v ) {\n* return v * 2;\n* }\n*\n* var x = [ [ 1, 2 ], [ 3, 4 ] ];\n*\n* var out = flatten2dBy( x, [ 2, 2 ], true, new Float64Array( 4 ), 1, 0, scale );\n* // returns [ 2, 6, 4, 8 ]\n*/\nfunction flatten2dBy( x, shape, colexicographic, out, stride, offset, clbk, thisArg ) { // eslint-disable-line max-len\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar a0;\n\tvar io;\n\n\t// Extract loop variables:\n\tS0 = shape[ 1 ]; // for nested arrays, the last dimensions have the fastest changing indices\n\tS1 = shape[ 0 ];\n\n\t// Iterate over the array dimensions...\n\tio = offset;\n\tif ( colexicographic ) {\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\tout[ io ] = clbk.call( thisArg, x[ i1 ][ i0 ], [ i1, i0 ], x ); // equivalent to storing in column-major (Fortran-style) order\n\t\t\t\tio += stride;\n\t\t\t}\n\t\t}\n\t\treturn out;\n\t}\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\ta0 = x[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tout[ io ] = clbk.call( thisArg, a0[ i0 ], [ i1, i0 ], x ); // equivalent to storing in row-major (C-style) order\n\t\t\tio += stride;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = flatten2dBy;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Flatten a two-dimensional nested array according to a callback function.\n*\n* @module @stdlib/array-base-flatten2d-by\n*\n* @example\n* var flatten2dBy = require( '@stdlib/array-base-flatten2d-by' );\n*\n* function scale( v ) {\n* return v * 2;\n* }\n*\n* var x = [ [ 1, 2 ], [ 3, 4 ] ];\n*\n* var out = flatten2dBy( x, [ 2, 2 ], false, scale );\n* // returns [ 2, 4, 6, 8 ]\n*\n* @example\n* var flatten2dBy = require( '@stdlib/array-base-flatten2d-by' );\n*\n* function scale( v ) {\n* return v * 2;\n* }\n*\n* var x = [ [ 1, 2 ], [ 3, 4 ] ];\n*\n* var out = flatten2dBy( x, [ 2, 2 ], true, scale );\n* // returns [ 2, 6, 4, 8 ]\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n* var flatten2dBy = require( '@stdlib/array-base-flatten2d-by' );\n*\n* function scale( v ) {\n* return v * 2;\n* }\n*\n* var x = [ [ 1, 2 ], [ 3, 4 ] ];\n*\n* var out = new Float64Array( 4 );\n* var y = flatten2dBy( x, [ 2, 2 ], true, out, 1, 0, scale );\n* // returns [ 2, 6, 4, 8 ]\n*\n* var bool = ( y === out );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"],
- "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAwDA,SAASC,EAAaC,EAAGC,EAAOC,EAAiBC,EAAMC,EAAU,CAChE,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EAUJ,GAPAJ,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EAGdI,EAAM,CAAC,EAGFH,EAAkB,CACtB,IAAMM,EAAK,EAAGA,EAAKF,EAAIE,IACtB,IAAMC,EAAK,EAAGA,EAAKF,EAAIE,IACtBJ,EAAI,KAAMF,EAAK,KAAMC,EAASJ,EAAGS,CAAG,EAAGD,CAAG,EAAG,CAAEC,EAAID,CAAG,EAAGR,CAAE,CAAE,EAG/D,OAAOK,CACR,CACA,IAAMI,EAAK,EAAGA,EAAKF,EAAIE,IAEtB,IADAC,EAAKV,EAAGS,CAAG,EACLD,EAAK,EAAGA,EAAKF,EAAIE,IACtBH,EAAI,KAAMF,EAAK,KAAMC,EAASM,EAAIF,CAAG,EAAG,CAAEC,EAAID,CAAG,EAAGR,CAAE,CAAE,EAG1D,OAAOK,CACR,CAKAP,EAAO,QAAUC,IC5FjB,IAAAY,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA+DA,SAASC,EAAaC,EAAGC,EAAOC,EAAiBC,EAAKC,EAAQC,EAAQC,EAAMC,EAAU,CACrF,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,GALAL,EAAKP,EAAO,CAAE,EACdQ,EAAKR,EAAO,CAAE,EAGdY,EAAKR,EACAH,EAAkB,CACtB,IAAMQ,EAAK,EAAGA,EAAKF,EAAIE,IACtB,IAAMC,EAAK,EAAGA,EAAKF,EAAIE,IACtBR,EAAKU,CAAG,EAAIP,EAAK,KAAMC,EAASP,EAAGW,CAAG,EAAGD,CAAG,EAAG,CAAEC,EAAID,CAAG,EAAGV,CAAE,EAC7Da,GAAMT,EAGR,OAAOD,CACR,CACA,IAAMQ,EAAK,EAAGA,EAAKF,EAAIE,IAEtB,IADAC,EAAKZ,EAAGW,CAAG,EACLD,EAAK,EAAGA,EAAKF,EAAIE,IACtBP,EAAKU,CAAG,EAAIP,EAAK,KAAMC,EAASK,EAAIF,CAAG,EAAG,CAAEC,EAAID,CAAG,EAAGV,CAAE,EACxDa,GAAMT,EAGR,OAAOD,CACR,CAKAL,EAAO,QAAUC,IC9BjB,IAAIe,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD",
- "names": ["require_main", "__commonJSMin", "exports", "module", "flatten2dBy", "x", "shape", "colexicographic", "clbk", "thisArg", "out", "S0", "S1", "i0", "i1", "a0", "require_assign", "__commonJSMin", "exports", "module", "flatten2dBy", "x", "shape", "colexicographic", "out", "stride", "offset", "clbk", "thisArg", "S0", "S1", "i0", "i1", "a0", "io", "setReadOnly", "main", "assign"]
-}
diff --git a/docs/repl.txt b/docs/repl.txt
deleted file mode 100644
index a46014b..0000000
--- a/docs/repl.txt
+++ /dev/null
@@ -1,106 +0,0 @@
-
-{{alias}}( x, shape, colex, clbk[, thisArg] )
- Flattens a two-dimensional nested array according to a callback function.
-
- The function assumes that all nested arrays have the same length (i.e., the
- input array is *not* a ragged array).
-
- The callback function is provided the following arguments:
-
- - value: nested array element.
- - indices: element indices (in lexicographic order).
- - arr: the input array.
-
- Parameters
- ----------
- x: Array
- Input array.
-
- shape: Array
- Array shape.
-
- colex: boolean
- Specifies whether to flatten array values in colexicographic order.
-
- clbk: Function
- Callback function.
-
- thisArg: any (optional)
- Callback execution context.
-
- Returns
- -------
- out: Array
- Flattened array.
-
- Examples
- --------
- > function fcn( v ) { return v * 2; };
- > var x = [ [ 1, 2 ], [ 3, 4 ] ];
- > var out = {{alias}}( x, [ 2, 2 ], false, fcn )
- [ 2, 4, 6, 8 ]
- > out = {{alias}}( x, [ 2, 2 ], true, fcn )
- [ 2, 6, 4, 8 ]
-
-
-{{alias}}.assign( x, shape, colex, out, stride, offset, clbk[, thisArg] )
- Flattens a two-dimensional nested array according to a callback function
- and assigns elements to a provided output array.
-
- The function assumes that all nested arrays have the same length (i.e., the
- input array is *not* a ragged array).
-
- The callback function is provided the following arguments:
-
- - value: nested array element.
- - indices: element indices (in lexicographic order).
- - arr: the input array.
-
- Parameters
- ----------
- x: Array
- Input array.
-
- shape: Array
- Array shape.
-
- colex: boolean
- Specifies whether to flatten array values in colexicographic order.
-
- out: Collection
- Output array.
-
- stride: integer
- Output array stride.
-
- offset: integer
- Output array index offset.
-
- clbk: Function
- Callback function.
-
- thisArg: any (optional)
- Callback execution context.
-
- Returns
- -------
- out: Array
- Output array.
-
- Examples
- --------
- > function fcn( v ) { return v * 2; };
- > var x = [ [ 1, 2 ], [ 3, 4 ] ];
- > var out = [ 0, 0, 0, 0 ];
- > var v = {{alias}}.assign( x, [ 2, 2 ], false, out, 1, 0, fcn )
- [ 2, 4, 6, 8 ]
- > var bool = ( v === out )
- true
- > out = [ 0, 0, 0, 0 ];
- > {{alias}}.assign( x, [ 2, 2 ], true, out, 1, 0, fcn );
- > out
- [ 2, 6, 4, 8 ]
-
- See Also
- --------
-
diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts
deleted file mode 100644
index 0021add..0000000
--- a/docs/types/index.d.ts
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
-* @license Apache-2.0
-*
-* Copyright (c) 2023 The Stdlib Authors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-// TypeScript Version: 4.1
-
-///
-
-import { Collection, Array2D } from '@stdlib/types/array';
-import { Shape2D } from '@stdlib/types/ndarray';
-
-/**
-* Nullary callback function.
-*
-* @returns result
-*/
-type Nullary = ( this: V ) => U;
-
-/**
-* Unary callback function.
-*
-* @param value - array element
-* @returns result
-*/
-type Unary = ( this: V, value: T ) => U;
-
-/**
-* Binary callback function.
-*
-* @param value - array element
-* @param indices - element indices
-* @returns result
-*/
-type Binary = ( this: V, value: T, indices: Array ) => U;
-
-/**
-* Ternary callback function.
-*
-* @param value - array element
-* @param indices - element indices
-* @param arr - input array
-* @returns result
-*/
-type Ternary = ( this: V, value: T, indices: Array, arr: Array2D ) => U;
-
-/**
-* Callback function.
-*
-* @param value - array element
-* @param indices - element indices
-* @param arr - input array
-* @returns result
-*/
-type Callback = Nullary | Unary | Binary | Ternary;
-
-/**
-* Interface describing `flatten2dBy`.
-*/
-interface Flatten2dBy {
- /**
- * Flattens a two-dimensional nested array according to a callback function.
- *
- * ## Notes
- *
- * - The function assumes that all nested arrays have the same length (i.e., the input array is **not** a ragged array).
- *
- * @param x - input array
- * @param shape - array shape
- * @param colexicographic - specifies whether to flatten array values in colexicographic order
- * @param clbk - callback function
- * @param thisArg - callback execution context
- * @returns flattened array
- *
- * @example
- * function scale( v ) {
- * return v * 2;
- * }
- *
- * var x = [ [ 1, 2 ], [ 3, 4 ] ];
- *
- * var out = flatten2dBy( x, [ 2, 2 ], false, scale );
- * // returns [ 2, 4, 6, 8 ]
- *
- * @example
- * function scale( v ) {
- * return v * 2;
- * }
- *
- * var x = [ [ 1, 2 ], [ 3, 4 ] ];
- *
- * var out = flatten2dBy( x, [ 2, 2 ], true, scale );
- * // returns [ 2, 6, 4, 8 ]
- */
- ( x: Array2D, shape: Shape2D, colexicographic: boolean, clbk: Callback, thisArg?: ThisParameterType> ): Array;
-
-
- /**
- * Flattens a two-dimensional nested array according to a callback function and assigns elements to a provided output array.
- *
- * ## Notes
- *
- * - The function assumes that all nested arrays have the same length (i.e., the input array is **not** a ragged array).
- *
- * @param x - input array
- * @param shape - array shape
- * @param colexicographic - specifies whether to flatten array values in colexicographic order
- * @param out - output array
- * @param stride - output array stride
- * @param offset - output array index offset
- * @param clbk - callback function
- * @param thisArg - callback execution context
- * @returns output array
- *
- * @example
- * var Float64Array = require( '@stdlib/array-float64' );
- *
- * function scale( v ) {
- * return v * 2;
- * }
- *
- * var x = [ [ 1, 2 ], [ 3, 4 ] ];
- *
- * var out = flatten2dBy( x, [ 2, 2 ], false, new Float64Array( 4 ), 1, 0, scale );
- * // returns [ 2, 4, 6, 8 ]
- *
- * @example
- * var Float64Array = require( '@stdlib/array-float64' );
- *
- * function scale( v ) {
- * return v * 2;
- * }
- *
- * var x = [ [ 1, 2 ], [ 3, 4 ] ];
- *
- * var out = flatten2dBy( x, [ 2, 2 ], true, new Float64Array( 4 ), 1, 0, scale );
- * // returns [ 2, 6, 4, 8 ]
- */
- assign( x: Array2D, shape: Shape2D, colexicographic: boolean, out: Collection, stride: number, offset: number, clbk: Callback, thisArg?: ThisParameterType> ): Collection;
-}
-
-/**
-* Flattens a two-dimensional nested array according to a callback function.
-*
-* ## Notes
-*
-* - The function assumes that all nested arrays have the same length (i.e., the input array is **not** a ragged array).
-*
-* @param x - input array
-* @param shape - array shape
-* @param colexicographic - specifies whether to flatten array values in colexicographic order
-* @param clbk - callback function
-* @param thisArg - callback execution context
-* @returns flattened array
-*
-* @example
-* function scale( v ) {
-* return v * 2;
-* }
-*
-* var x = [ [ 1, 2 ], [ 3, 4 ] ];
-*
-* var out = flatten2dBy( x, [ 2, 2 ], false, scale );
-* // returns [ 2, 4, 6, 8 ]
-*
-* @example
-* function scale( v ) {
-* return v * 2;
-* }
-*
-* var x = [ [ 1, 2 ], [ 3, 4 ] ];
-*
-* var out = flatten2dBy( x, [ 2, 2 ], true, scale );
-* // returns [ 2, 6, 4, 8 ]
-*/
-declare var flatten2dBy: Flatten2dBy;
-
-
-// EXPORTS //
-
-export = flatten2dBy;
diff --git a/docs/types/test.ts b/docs/types/test.ts
deleted file mode 100644
index 1d4e2b9..0000000
--- a/docs/types/test.ts
+++ /dev/null
@@ -1,340 +0,0 @@
-/*
-* @license Apache-2.0
-*
-* Copyright (c) 2023 The Stdlib Authors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-import flatten2dBy = require( './index' );
-
-/**
-* Identity function.
-*
-* @param value - input value
-* @returns input value
-*/
-function identity( value: T ): T {
- return value;
-}
-
-
-// TESTS //
-
-// The function returns an array...
-{
- const x = [ [ 1, 2 ], [ 3, 4 ] ];
-
- flatten2dBy( x, [ 2, 2 ], false, identity ); // $ExpectType number[]
- flatten2dBy( x, [ 2, 2 ], true, identity ); // $ExpectType number[]
-
- flatten2dBy( x, [ 2, 2 ], false, identity, {} ); // $ExpectType number[]
- flatten2dBy( x, [ 2, 2 ], true, identity, {} ); // $ExpectType number[]
-
- flatten2dBy( [ [ '1', '2' ], [ '3', '4' ] ], [ 2, 2 ], false, identity ); // $ExpectType string[]
- flatten2dBy( [ [ '1', '2' ], [ '3', '4' ] ], [ 2, 2 ], true, identity ); // $ExpectType string[]
-
- flatten2dBy( [ [ '1', '2' ], [ '3', '4' ] ], [ 2, 2 ], false, identity, {} ); // $ExpectType string[]
- flatten2dBy( [ [ '1', '2' ], [ '3', '4' ] ], [ 2, 2 ], true, identity, {} ); // $ExpectType string[]
-}
-
-// The compiler throws an error if the function is provided a first argument which is not an array-like object...
-{
- flatten2dBy( 1, [ 2, 2 ], false, identity ); // $ExpectError
- flatten2dBy( true, [ 2, 2 ], false, identity ); // $ExpectError
- flatten2dBy( false, [ 2, 2 ], false, identity ); // $ExpectError
- flatten2dBy( null, [ 2, 2 ], false, identity ); // $ExpectError
- flatten2dBy( void 0, [ 2, 2 ], false, identity ); // $ExpectError
- flatten2dBy( {}, [ 2, 2 ], false, identity ); // $ExpectError
-
- flatten2dBy( 1, [ 2, 2 ], false, identity, {} ); // $ExpectError
- flatten2dBy( true, [ 2, 2 ], false, identity, {} ); // $ExpectError
- flatten2dBy( false, [ 2, 2 ], false, identity, {} ); // $ExpectError
- flatten2dBy( null, [ 2, 2 ], false, identity, {} ); // $ExpectError
- flatten2dBy( void 0, [ 2, 2 ], false, identity, {} ); // $ExpectError
- flatten2dBy( {}, [ 2, 2 ], false, identity, {} ); // $ExpectError
-}
-
-// The compiler throws an error if the function is provided a second argument which is not an array-like object containing numbers...
-{
- const x = [ [ 1, 2 ], [ 3, 4 ] ];
-
- flatten2dBy( x, '', false, identity ); // $ExpectError
- flatten2dBy( x, 1, false, identity ); // $ExpectError
- flatten2dBy( x, true, false, identity ); // $ExpectError
- flatten2dBy( x, false, false, identity ); // $ExpectError
- flatten2dBy( x, null, false, identity ); // $ExpectError
- flatten2dBy( x, void 0, false, identity ); // $ExpectError
- flatten2dBy( x, {}, false, identity ); // $ExpectError
- flatten2dBy( x, [ 1, '2', 3 ], false, identity ); // $ExpectError
- flatten2dBy( x, ( x: number ): number => x, false, identity ); // $ExpectError
-
- flatten2dBy( x, '', false, identity, {} ); // $ExpectError
- flatten2dBy( x, 1, false, identity, {} ); // $ExpectError
- flatten2dBy( x, true, false, identity, {} ); // $ExpectError
- flatten2dBy( x, false, false, identity, {} ); // $ExpectError
- flatten2dBy( x, null, false, identity, {} ); // $ExpectError
- flatten2dBy( x, void 0, false, identity, {} ); // $ExpectError
- flatten2dBy( x, {}, false, identity, {} ); // $ExpectError
- flatten2dBy( x, [ 1, '2', 3 ], false, identity, {} ); // $ExpectError
- flatten2dBy( x, ( x: number ): number => x, false, identity, {} ); // $ExpectError
-}
-
-// The compiler throws an error if the function is provided a third argument which is not a boolean...
-{
- const x = [ [ 1, 2 ], [ 3, 4 ] ];
-
- flatten2dBy( x, [ 2, 2 ], '', identity ); // $ExpectError
- flatten2dBy( x, [ 2, 2 ], 1, identity ); // $ExpectError
- flatten2dBy( x, [ 2, 2 ], null, identity ); // $ExpectError
- flatten2dBy( x, [ 2, 2 ], void 0, identity ); // $ExpectError
- flatten2dBy( x, [ 2, 2 ], {}, identity ); // $ExpectError
- flatten2dBy( x, [ 2, 2 ], [], identity ); // $ExpectError
- flatten2dBy( x, [ 2, 2 ], ( x: number ): number => x, identity ); // $ExpectError
-
- flatten2dBy( x, [ 2, 2 ], '', identity, {} ); // $ExpectError
- flatten2dBy( x, [ 2, 2 ], 1, identity, {} ); // $ExpectError
- flatten2dBy( x, [ 2, 2 ], null, identity, {} ); // $ExpectError
- flatten2dBy( x, [ 2, 2 ], void 0, identity, {} ); // $ExpectError
- flatten2dBy( x, [ 2, 2 ], {}, identity, {} ); // $ExpectError
- flatten2dBy( x, [ 2, 2 ], [], identity, {} ); // $ExpectError
- flatten2dBy( x, [ 2, 2 ], ( x: number ): number => x, identity, {} ); // $ExpectError
-}
-
-// The compiler throws an error if the function is provided a fourth argument which is not a function...
-{
- const x = [ [ 1, 2 ], [ 3, 4 ] ];
-
- flatten2dBy( x, [ 2, 2 ], false, '' ); // $ExpectError
- flatten2dBy( x, [ 2, 2 ], false, 1 ); // $ExpectError
- flatten2dBy( x, [ 2, 2 ], false, true ); // $ExpectError
- flatten2dBy( x, [ 2, 2 ], false, false ); // $ExpectError
- flatten2dBy( x, [ 2, 2 ], false, null ); // $ExpectError
- flatten2dBy( x, [ 2, 2 ], false, void 0 ); // $ExpectError
- flatten2dBy( x, [ 2, 2 ], false, {} ); // $ExpectError
- flatten2dBy( x, [ 2, 2 ], false, [] ); // $ExpectError
-
- flatten2dBy( x, [ 2, 2 ], false, '', {} ); // $ExpectError
- flatten2dBy( x, [ 2, 2 ], false, 1, {} ); // $ExpectError
- flatten2dBy( x, [ 2, 2 ], false, true, {} ); // $ExpectError
- flatten2dBy( x, [ 2, 2 ], false, false, {} ); // $ExpectError
- flatten2dBy( x, [ 2, 2 ], false, null, {} ); // $ExpectError
- flatten2dBy( x, [ 2, 2 ], false, void 0, {} ); // $ExpectError
- flatten2dBy( x, [ 2, 2 ], false, {}, {} ); // $ExpectError
- flatten2dBy( x, [ 2, 2 ], false, [], {} ); // $ExpectError
-}
-
-// The compiler throws an error if the function is provided an unsupported number of arguments...
-{
- const x = [ [ 1, 2 ], [ 3, 4 ] ];
-
- flatten2dBy(); // $ExpectError
- flatten2dBy( x ); // $ExpectError
- flatten2dBy( x, [ 2, 2 ] ); // $ExpectError
- flatten2dBy( x, [ 2, 2 ], false ); // $ExpectError
- flatten2dBy( x, [ 2, 2 ], false, identity, {}, {} ); // $ExpectError
-}
-
-// Attached to the main export is an `assign` method which returns a collection...
-{
- const x = [ [ 1, 2 ], [ 3, 4 ] ];
-
- const out1 = [ 0, 0, 0, 0 ];
-
- flatten2dBy.assign( x, [ 2, 2 ], false, out1, 1, 0, identity ); // $ExpectType Collection
- flatten2dBy.assign( x, [ 2, 2 ], true, out1, 1, 0, identity ); // $ExpectType Collection
-
- flatten2dBy.assign( x, [ 2, 2 ], false, out1, 1, 0, identity, {} ); // $ExpectType Collection
- flatten2dBy.assign( x, [ 2, 2 ], true, out1, 1, 0, identity, {} ); // $ExpectType Collection
-
- const out2 = [ '', '', '', '' ];
-
- flatten2dBy.assign( [ [ '1', '2' ], [ '3', '4' ] ], [ 2, 2 ], false, out2, 1, 0, identity ); // $ExpectType Collection
- flatten2dBy.assign( [ [ '1', '2' ], [ '3', '4' ] ], [ 2, 2 ], true, out2, 1, 0, identity ); // $ExpectType Collection
-
- flatten2dBy.assign( [ [ '1', '2' ], [ '3', '4' ] ], [ 2, 2 ], false, out2, 1, 0, identity, {} ); // $ExpectType Collection
- flatten2dBy.assign( [ [ '1', '2' ], [ '3', '4' ] ], [ 2, 2 ], true, out2, 1, 0, identity, {} ); // $ExpectType Collection
-}
-
-// The compiler throws an error if the `assign` method is provided a first argument which is not an array-like object...
-{
- const out = [ 0, 0, 0, 0 ];
-
- flatten2dBy.assign( 1, [ 2, 2 ], false, out, 1, 0, identity ); // $ExpectError
- flatten2dBy.assign( true, [ 2, 2 ], false, out, 1, 0, identity ); // $ExpectError
- flatten2dBy.assign( false, [ 2, 2 ], false, out, 1, 0, identity ); // $ExpectError
- flatten2dBy.assign( null, [ 2, 2 ], false, out, 1, 0, identity ); // $ExpectError
- flatten2dBy.assign( void 0, [ 2, 2 ], false, out, 1, 0, identity ); // $ExpectError
- flatten2dBy.assign( {}, [ 2, 2 ], false, out, 1, 0, identity ); // $ExpectError
-
- flatten2dBy.assign( 1, [ 2, 2 ], false, out, 1, 0, identity, {} ); // $ExpectError
- flatten2dBy.assign( true, [ 2, 2 ], false, out, 1, 0, identity, {} ); // $ExpectError
- flatten2dBy.assign( false, [ 2, 2 ], false, out, 1, 0, identity, {} ); // $ExpectError
- flatten2dBy.assign( null, [ 2, 2 ], false, out, 1, 0, identity, {} ); // $ExpectError
- flatten2dBy.assign( void 0, [ 2, 2 ], false, out, 1, 0, identity, {} ); // $ExpectError
- flatten2dBy.assign( {}, [ 2, 2 ], false, out, 1, 0, identity, {} ); // $ExpectError
-}
-
-// The compiler throws an error if the `assign` method is provided a second argument which is not an array-like object containing numbers...
-{
- const x = [ [ 1, 2 ], [ 3, 4 ] ];
- const out = [ 0, 0, 0, 0 ];
-
- flatten2dBy.assign( x, '', false, out, 1, 0, identity ); // $ExpectError
- flatten2dBy.assign( x, 1, false, out, 1, 0, identity ); // $ExpectError
- flatten2dBy.assign( x, true, false, out, 1, 0, identity ); // $ExpectError
- flatten2dBy.assign( x, false, false, out, 1, 0, identity ); // $ExpectError
- flatten2dBy.assign( x, null, false, out, 1, 0, identity ); // $ExpectError
- flatten2dBy.assign( x, void 0, false, out, 1, 0, identity ); // $ExpectError
- flatten2dBy.assign( x, {}, false, out, 1, 0, identity ); // $ExpectError
- flatten2dBy.assign( x, [ 1, '2', 3 ], false, out, 1, 0, identity ); // $ExpectError
- flatten2dBy.assign( x, ( x: number ): number => x, false, out, 1, 0, identity ); // $ExpectError
-
- flatten2dBy.assign( x, '', false, out, 1, 0, identity, {} ); // $ExpectError
- flatten2dBy.assign( x, 1, false, out, 1, 0, identity, {} ); // $ExpectError
- flatten2dBy.assign( x, true, false, out, 1, 0, identity, {} ); // $ExpectError
- flatten2dBy.assign( x, false, false, out, 1, 0, identity, {} ); // $ExpectError
- flatten2dBy.assign( x, null, false, out, 1, 0, identity, {} ); // $ExpectError
- flatten2dBy.assign( x, void 0, false, out, 1, 0, identity, {} ); // $ExpectError
- flatten2dBy.assign( x, {}, false, out, 1, 0, identity, {} ); // $ExpectError
- flatten2dBy.assign( x, [ 1, '2', 3 ], false, out, 1, 0, identity, {} ); // $ExpectError
- flatten2dBy.assign( x, ( x: number ): number => x, false, out, 1, 0, identity, {} ); // $ExpectError
-}
-
-// The compiler throws an error if the `assign` method is provided a third argument which is not a boolean...
-{
- const x = [ [ 1, 2 ], [ 3, 4 ] ];
- const out = [ 0, 0, 0, 0 ];
-
- flatten2dBy.assign( x, [ 2, 2 ], '', out, 1, 0, identity ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], 1, out, 1, 0, identity ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], null, out, 1, 0, identity ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], void 0, out, 1, 0, identity ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], {}, out, 1, 0, identity ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], [], out, 1, 0, identity ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], ( x: number ): number => x, out, 1, 0, identity ); // $ExpectError
-
- flatten2dBy.assign( x, [ 2, 2 ], '', out, 1, 0, identity, {} ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], 1, out, 1, 0, identity, {} ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], null, out, 1, 0, identity, {} ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], void 0, out, 1, 0, identity, {} ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], {}, out, 1, 0, identity, {} ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], [], out, 1, 0, identity, {} ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], ( x: number ): number => x, out, 1, 0, identity, {} ); // $ExpectError
-}
-
-// The compiler throws an error if the `assign` method is provided a fourth argument which is not an array-like object...
-{
- const x = [ [ 1, 2 ], [ 3, 4 ] ];
-
- flatten2dBy.assign( x, [ 2, 2 ], false, 1, 1, 0, identity ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, true, 1, 0, identity ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, false, 1, 0, identity ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, null, 1, 0, identity ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, void 0, 1, 0, identity ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, {}, 1, 0, identity ); // $ExpectError
-
- flatten2dBy.assign( x, [ 2, 2 ], false, 1, 1, 0, identity, {} ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, true, 1, 0, identity, {} ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, false, 1, 0, identity, {} ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, null, 1, 0, identity, {} ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, void 0, 1, 0, identity, {} ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, {}, 1, 0, identity, {} ); // $ExpectError
-}
-
-// The compiler throws an error if the `assign` method is provided a fifth argument which is not a number...
-{
- const x = [ [ 1, 2 ], [ 3, 4 ] ];
- const out = [ 0, 0, 0, 0 ];
-
- flatten2dBy.assign( x, [ 2, 2 ], false, out, '1', 0, identity ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, out, true, 0, identity ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, out, false, 0, identity ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, out, null, 0, identity ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, out, void 0, 0, identity ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, out, {}, 0, identity ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, out, [], 0, identity ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, out, ( x: number ): number => x, 0, identity ); // $ExpectError
-
- flatten2dBy.assign( x, [ 2, 2 ], false, out, '1', 0, identity, {} ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, out, true, 0, identity, {} ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, out, false, 0, identity, {} ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, out, null, 0, identity, {} ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, out, void 0, 0, identity, {} ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, out, {}, 0, identity, {} ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, out, [], 0, identity, {} ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, out, ( x: number ): number => x, 0, identity, {} ); // $ExpectError
-}
-
-// The compiler throws an error if the `assign` method is provided a sixth argument which is not a number...
-{
- const x = [ [ 1, 2 ], [ 3, 4 ] ];
- const out = [ 0, 0, 0, 0 ];
-
- flatten2dBy.assign( x, [ 2, 2 ], false, out, 1, '1', identity ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, out, 1, true, identity ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, out, 1, false, identity ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, out, 1, null, identity ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, out, 1, void 0, identity ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, out, 1, {}, identity ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, out, 1, [], identity ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, out, 1, ( x: number ): number => x, identity ); // $ExpectError
-
- flatten2dBy.assign( x, [ 2, 2 ], false, out, 1, '1', identity, {} ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, out, 1, true, identity, {} ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, out, 1, false, identity, {} ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, out, 1, null, identity, {} ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, out, 1, void 0, identity, {} ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, out, 1, {}, identity, {} ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, out, 1, [], identity, {} ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, out, 1, ( x: number ): number => x, identity, {} ); // $ExpectError
-}
-
-// The compiler throws an error if the `assign` method is provided a seventh argument which is not a function...
-{
- const x = [ [ 1, 2 ], [ 3, 4 ] ];
- const out = [ 0, 0, 0, 0 ];
-
- flatten2dBy.assign( x, [ 2, 2 ], false, out, 1, 0, '1' ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, out, 1, 0, 1 ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, out, 1, 0, true ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, out, 1, 0, false ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, out, 1, 0, null ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, out, 1, 0, void 0 ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, out, 1, 0, {} ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, out, 1, 0, [] ); // $ExpectError
-
- flatten2dBy.assign( x, [ 2, 2 ], false, out, 1, 0, '1', {} ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, out, 1, 0, 1, {} ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, out, 1, 0, true, {} ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, out, 1, 0, false, {} ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, out, 1, 0, null, {} ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, out, 1, 0, void 0, {} ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, out, 1, 0, {}, {} ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, out, 1, 0, [], {} ); // $ExpectError
-}
-
-// The compiler throws an error if the `assign` method is provided an unsupported number of arguments...
-{
- const x = [ [ 1, 2 ], [ 3, 4 ] ];
- const out = [ 0, 0, 0, 0 ];
-
- flatten2dBy.assign(); // $ExpectError
- flatten2dBy.assign( x ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ] ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, out ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, out, 1 ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, out, 1, 0 ); // $ExpectError
- flatten2dBy.assign( x, [ 2, 2 ], false, out, 1, 0, identity, {}, {} ); // $ExpectError
-}
diff --git a/examples/index.js b/examples/index.js
deleted file mode 100644
index ef9daef..0000000
--- a/examples/index.js
+++ /dev/null
@@ -1,72 +0,0 @@
-/**
-* @license Apache-2.0
-*
-* Copyright (c) 2023 The Stdlib Authors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-'use strict';
-
-var naryFunction = require( '@stdlib/utils-nary-function' );
-var abs = require( '@stdlib/math-base-special-abs' );
-var flatten2dBy = require( './../lib' );
-
-var fcn = naryFunction( abs, 1 );
-
-var x = [
- [ -1, -2, -3, -4 ],
- [ -5, -6, -7, -8 ],
- [ -9, -10, -11, -12 ],
- [ -13, -14, -15, -16 ]
-];
-
-var out = flatten2dBy( x, [ 0, 0 ], false, fcn );
-console.log( out );
-// => []
-
-out = flatten2dBy( x, [ 0, 0 ], true, fcn );
-console.log( out );
-// => []
-
-out = flatten2dBy( x, [ 1, 1 ], false, fcn );
-console.log( out );
-// => [ 1 ]
-
-out = flatten2dBy( x, [ 1, 1 ], true, fcn );
-console.log( out );
-// => [ 1 ]
-
-out = flatten2dBy( x, [ 2, 2 ], false, fcn );
-console.log( out );
-// => [ 1, 2, 5, 6 ]
-
-out = flatten2dBy( x, [ 2, 2 ], true, fcn );
-console.log( out );
-// => [ 1, 5, 2, 6 ]
-
-out = flatten2dBy( x, [ 3, 3 ], false, fcn );
-console.log( out );
-// => [ 1, 2, 3, 5, 6, 7, 9, 10, 11 ]
-
-out = flatten2dBy( x, [ 3, 3 ], true, fcn );
-console.log( out );
-// => [ 1, 5, 9, 2, 6, 10, 3, 7, 11 ]
-
-out = flatten2dBy( x, [ 4, 4 ], false, fcn );
-console.log( out );
-// => [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 ]
-
-out = flatten2dBy( x, [ 4, 4 ], true, fcn );
-console.log( out );
-// => [ 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15, 4, 8, 12, 16 ]
diff --git a/index.js b/index.js
new file mode 100644
index 0000000..63c465e
--- /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
+var e,r;e=this,r=function(){"use strict";var e="function"==typeof Object.defineProperty?Object.defineProperty:null,r=Object.defineProperty;function i(e){return"number"==typeof e}function t(e){var r,i="";for(r=0;r0&&(r-=1),t=a.toExponential(r)):t=a.toPrecision(e.precision),e.alternate||(t=f.call(t,v,"$1e"),t=f.call(t,b,"e"),t=f.call(t,w,""));break;default:throw new Error("invalid double notation. Value: "+e.specifier)}return t=f.call(t,u,"e+0$1"),t=f.call(t,g,"e-0$1"),e.alternate&&(t=f.call(t,d,"$1."),t=f.call(t,h,"$1.e")),a>=0&&e.sign&&(t=e.sign+t),t=e.specifier===p.call(e.specifier)?p.call(t):l.call(t)}function m(e){var r,i="";for(r=0;r127)throw new Error("invalid character code. Value: "+t.arg);t.arg=k(o)?String(t.arg):_(o)}break;case"e":case"E":case"f":case"F":case"g":case"G":r||(t.precision=6),t.arg=y(t);break;default:throw new Error("invalid specifier: "+t.specifier)}t.maxWidth>=0&&t.arg.length>t.maxWidth&&(t.arg=t.arg.substring(0,t.maxWidth)),t.padZeros?t.arg=a(t.arg,t.width||t.precision,t.padRight):t.width&&(t.arg=(u=t.arg,g=t.width,d=t.padRight,h=void 0,(h=g-u.length)<0?u:u=d?u+m(h):m(h)+u)),c+=t.arg||"",l+=1}return c}var j=/%(?:([1-9]\d*)\$)?([0 +\-#]*)(\*|\d+)?(?:(\.)(\*|\d+)?)?[hlL]?([%A-Za-z])/g;function V(e){var r={mapping:e[1]?parseInt(e[1],10):void 0,flags:e[2],width:e[3],precision:e[5],specifier:e[6]};return"."===e[4]&&void 0===e[5]&&(r.precision="1"),r}function T(e){var r,i,t,a;for(i=[],a=0,t=j.exec(e);t;)(r=e.slice(a,j.lastIndex-t[0].length)).length&&i.push(r),i.push(V(t)),a=j.lastIndex,t=j.exec(e);return(r=e.slice(a)).length&&i.push(r),i}function $(e){var r,i;if("string"!=typeof e)throw new TypeError($("invalid argument. First argument must be a string. Value: `%s`.",e));for(r=[T(e)],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) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Flattens a two-dimensional nested array according to a callback function.\n*\n* ## Notes\n*\n* - The function assumes that all nested arrays have the same length (i.e., the input array is **not** a ragged array).\n*\n* @param {Array} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {boolean} colexicographic - specifies whether to flatten array values in colexicographic order\n* @param {Function} clbk - callback function\n* @param {*} [thisArg] - callback execution context\n* @returns {Array} flattened array\n*\n* @example\n* function scale( v ) {\n* return v * 2;\n* }\n*\n* var x = [ [ 1, 2 ], [ 3, 4 ] ];\n*\n* var out = flatten2dBy( x, [ 2, 2 ], false, scale );\n* // returns [ 2, 4, 6, 8 ]\n*\n* @example\n* function scale( v ) {\n* return v * 2;\n* }\n*\n* var x = [ [ 1, 2 ], [ 3, 4 ] ];\n*\n* var out = flatten2dBy( x, [ 2, 2 ], true, scale );\n* // returns [ 2, 6, 4, 8 ]\n*/\nfunction flatten2dBy( x, shape, colexicographic, clbk, thisArg ) {\n\tvar out;\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar a0;\n\n\t// Extract loop variables:\n\tS0 = shape[ 1 ]; // for nested arrays, the last dimensions have the fastest changing indices\n\tS1 = shape[ 0 ];\n\n\t// Initialize an output array:\n\tout = [];\n\n\t// Iterate over the array dimensions...\n\tif ( colexicographic ) {\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\tout.push( clbk.call( thisArg, x[ i1 ][ i0 ], [ i1, i0 ], x ) ); // equivalent to storing in column-major (Fortran-style) order\n\t\t\t}\n\t\t}\n\t\treturn out;\n\t}\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\ta0 = x[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tout.push( clbk.call( thisArg, a0[ i0 ], [ i1, i0 ], x ) ); // equivalent to storing in row-major (C-style) order\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default flatten2dBy;\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) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Flatten a two-dimensional nested array according to a callback function.\n*\n* @module @stdlib/array-base-flatten2d-by\n*\n* @example\n* import flatten2dBy from '@stdlib/array-base-flatten2d-by';\n*\n* function scale( v ) {\n* return v * 2;\n* }\n*\n* var x = [ [ 1, 2 ], [ 3, 4 ] ];\n*\n* var out = flatten2dBy( x, [ 2, 2 ], false, scale );\n* // returns [ 2, 4, 6, 8 ]\n*\n* @example\n* import flatten2dBy from '@stdlib/array-base-flatten2d-by';\n*\n* function scale( v ) {\n* return v * 2;\n* }\n*\n* var x = [ [ 1, 2 ], [ 3, 4 ] ];\n*\n* var out = flatten2dBy( x, [ 2, 2 ], true, scale );\n* // returns [ 2, 6, 4, 8 ]\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n* import flatten2dBy from '@stdlib/array-base-flatten2d-by';\n*\n* function scale( v ) {\n* return v * 2;\n* }\n*\n* var x = [ [ 1, 2 ], [ 3, 4 ] ];\n*\n* var out = new Float64Array( 4 );\n* var y = flatten2dBy( x, [ 2, 2 ], true, out, 1, 0, scale );\n* // returns [ 2, 6, 4, 8 ]\n*\n* var bool = ( y === out );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport 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) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Flattens a two-dimensional nested array according to a callback function and assigns elements to a provided output array.\n*\n* ## Notes\n*\n* - The function assumes that all nested arrays have the same length (i.e., the input array is **not** a ragged array).\n*\n* @param {Array} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {boolean} colexicographic - specifies whether to flatten array values in colexicographic order\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @param {Function} clbk - callback function\n* @param {*} [thisArg] - callback execution context\n* @returns {Collection} output array\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* function scale( v ) {\n* return v * 2;\n* }\n*\n* var x = [ [ 1, 2 ], [ 3, 4 ] ];\n*\n* var out = flatten2dBy( x, [ 2, 2 ], false, new Float64Array( 4 ), 1, 0, scale );\n* // returns [ 2, 4, 6, 8 ]\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* function scale( v ) {\n* return v * 2;\n* }\n*\n* var x = [ [ 1, 2 ], [ 3, 4 ] ];\n*\n* var out = flatten2dBy( x, [ 2, 2 ], true, new Float64Array( 4 ), 1, 0, scale );\n* // returns [ 2, 6, 4, 8 ]\n*/\nfunction flatten2dBy( x, shape, colexicographic, out, stride, offset, clbk, thisArg ) { // eslint-disable-line max-len\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar a0;\n\tvar io;\n\n\t// Extract loop variables:\n\tS0 = shape[ 1 ]; // for nested arrays, the last dimensions have the fastest changing indices\n\tS1 = shape[ 0 ];\n\n\t// Iterate over the array dimensions...\n\tio = offset;\n\tif ( colexicographic ) {\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\tout[ io ] = clbk.call( thisArg, x[ i1 ][ i0 ], [ i1, i0 ], x ); // equivalent to storing in column-major (Fortran-style) order\n\t\t\t\tio += stride;\n\t\t\t}\n\t\t}\n\t\treturn out;\n\t}\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\ta0 = x[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tout[ io ] = clbk.call( thisArg, a0[ i0 ], [ i1, i0 ], x ); // equivalent to storing in row-major (C-style) order\n\t\t\tio += stride;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default flatten2dBy;\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__","flatten2dBy","x","shape","colexicographic","clbk","thisArg","S0","S1","i0","i1","a0","err","hasDefinePropertySupport","builtin","obj","prop","descriptor","hasValue","hasGet","hasSet","__proto__","get","set","configurable","enumerable","writable","stride","offset","io"],"mappings":";yCAsBA,IAAIA,EAA0C,mBAA1BC,OAAOC,eAAkCD,OAAOC,eAAiB,KCiCjFA,EAAiBD,OAAOC,eCjB5B,SAASC,EAAUC,GAClB,MAA0B,iBAAVA,CACjB,CCAA,SAASC,EAAOC,GACf,IACIC,EADAC,EAAM,GAEV,IAAMD,EAAI,EAAGA,EAAID,EAAGC,IACnBC,GAAO,IAER,OAAOA,CACR,CAcA,SAASC,EAASC,EAAKC,EAAOC,GAC7B,IAAIC,GAAW,EACXC,EAAMH,EAAQD,EAAIK,OACtB,OAAKD,EAAM,IAnCZ,SAA0BJ,GACzB,MAAoB,MAAbA,EAAK,EACb,CAoCMM,CAAiBN,KACrBG,GAAW,EACXH,EAAMA,EAAIO,OAAQ,IAEnBP,EAAM,EACLA,EAAML,EAAOS,GACbT,EAAOS,GAAQJ,EACXG,IACJH,EAAM,IAAMA,IAVLA,CAaT,CCpDA,IAAIQ,EAAYC,OAAOC,UAAUC,YAC7BC,EAAYH,OAAOC,UAAUG,YAajC,SAASC,EAAeC,GACvB,IAAIC,EACAlB,EACAD,EAEJ,OAASkB,EAAME,WACf,IAAK,IAEJD,EAAO,EACP,MACD,IAAK,IAEJA,EAAO,EACP,MACD,IAAK,IACL,IAAK,IAEJA,EAAO,GACP,MAID,QAECA,EAAO,GAKR,GAFAlB,EAAMiB,EAAMG,IACZrB,EAAIsB,SAAUrB,EAAK,KACbsB,SAAUvB,GAAM,CACrB,IAAMJ,EAAUK,GACf,MAAM,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EAAKC,GAASC,EAAWlH,MAGzBgH,EAAIM,UAAYtG,GAEhBgG,EAAKC,GAASC,EAAWlH,OAG3BoH,EAAW,QAASF,EACpBG,EAAW,QAASH,EAEfC,IAAcC,GAAUC,GAC5B,MAAM,IAAI1F,MAAO,wHASlB,OANKyF,GAAU1B,GACdA,EAAazD,KAAM+E,EAAKC,EAAMC,EAAWK,KAErCF,GAAUzB,GACdA,EAAa3D,KAAM+E,EAAKC,EAAMC,EAAWM,KAEnCR,CACR,EC3DelH,EGmBFF,EAAM,SC9BS,CAC1B6H,cAAgB,EAChBC,YAAc,EACdC,UAAY,EACZ3H,MCaF,SAAsBmG,EAAGC,EAAOC,EAAiBjG,EAAKwH,EAAQC,EAAQvB,EAAMC,GAC3E,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAkB,EAQJ,GALAtB,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GAGZ0B,EAAKD,EACAxB,EAAkB,CACtB,IAAMK,EAAK,EAAGA,EAAKF,EAAIE,IACtB,IAAMC,EAAK,EAAGA,EAAKF,EAAIE,IACtBvG,EAAK0H,GAAOxB,EAAKrE,KAAMsE,EAASJ,EAAGQ,GAAMD,GAAM,CAAEC,EAAID,GAAMP,GAC3D2B,GAAMF,EAGR,OAAOxH,CACP,CACD,IAAMuG,EAAK,EAAGA,EAAKF,EAAIE,IAEtB,IADAC,EAAKT,EAAGQ,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBtG,EAAK0H,GAAOxB,EAAKrE,KAAMsE,EAASK,EAAIF,GAAM,CAAEC,EAAID,GAAMP,GACtD2B,GAAMF,EAGR,OAAOxH,CACR","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,15,17]}
\ No newline at end of file
diff --git a/lib/assign.js b/lib/assign.js
deleted file mode 100644
index 2907449..0000000
--- a/lib/assign.js
+++ /dev/null
@@ -1,100 +0,0 @@
-/**
-* @license Apache-2.0
-*
-* Copyright (c) 2023 The Stdlib Authors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-'use strict';
-
-// MAIN //
-
-/**
-* Flattens a two-dimensional nested array according to a callback function and assigns elements to a provided output array.
-*
-* ## Notes
-*
-* - The function assumes that all nested arrays have the same length (i.e., the input array is **not** a ragged array).
-*
-* @param {Array} x - input nested array
-* @param {NonNegativeIntegerArray} shape - array shape
-* @param {boolean} colexicographic - specifies whether to flatten array values in colexicographic order
-* @param {Collection} out - output array
-* @param {integer} stride - output array stride
-* @param {NonNegativeInteger} offset - output array index offset
-* @param {Function} clbk - callback function
-* @param {*} [thisArg] - callback execution context
-* @returns {Collection} output array
-*
-* @example
-* var Float64Array = require( '@stdlib/array-float64' );
-*
-* function scale( v ) {
-* return v * 2;
-* }
-*
-* var x = [ [ 1, 2 ], [ 3, 4 ] ];
-*
-* var out = flatten2dBy( x, [ 2, 2 ], false, new Float64Array( 4 ), 1, 0, scale );
-* // returns [ 2, 4, 6, 8 ]
-*
-* @example
-* var Float64Array = require( '@stdlib/array-float64' );
-*
-* function scale( v ) {
-* return v * 2;
-* }
-*
-* var x = [ [ 1, 2 ], [ 3, 4 ] ];
-*
-* var out = flatten2dBy( x, [ 2, 2 ], true, new Float64Array( 4 ), 1, 0, scale );
-* // returns [ 2, 6, 4, 8 ]
-*/
-function flatten2dBy( x, shape, colexicographic, out, stride, offset, clbk, thisArg ) { // eslint-disable-line max-len
- var S0;
- var S1;
- var i0;
- var i1;
- var a0;
- var io;
-
- // Extract loop variables:
- S0 = shape[ 1 ]; // for nested arrays, the last dimensions have the fastest changing indices
- S1 = shape[ 0 ];
-
- // Iterate over the array dimensions...
- io = offset;
- if ( colexicographic ) {
- for ( i0 = 0; i0 < S0; i0++ ) {
- for ( i1 = 0; i1 < S1; i1++ ) {
- out[ io ] = clbk.call( thisArg, x[ i1 ][ i0 ], [ i1, i0 ], x ); // equivalent to storing in column-major (Fortran-style) order
- io += stride;
- }
- }
- return out;
- }
- for ( i1 = 0; i1 < S1; i1++ ) {
- a0 = x[ i1 ];
- for ( i0 = 0; i0 < S0; i0++ ) {
- out[ io ] = clbk.call( thisArg, a0[ i0 ], [ i1, i0 ], x ); // equivalent to storing in row-major (C-style) order
- io += stride;
- }
- }
- return out;
-}
-
-
-// EXPORTS //
-
-module.exports = flatten2dBy;
diff --git a/lib/index.js b/lib/index.js
deleted file mode 100644
index a99853f..0000000
--- a/lib/index.js
+++ /dev/null
@@ -1,82 +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';
-
-/**
-* Flatten a two-dimensional nested array according to a callback function.
-*
-* @module @stdlib/array-base-flatten2d-by
-*
-* @example
-* var flatten2dBy = require( '@stdlib/array-base-flatten2d-by' );
-*
-* function scale( v ) {
-* return v * 2;
-* }
-*
-* var x = [ [ 1, 2 ], [ 3, 4 ] ];
-*
-* var out = flatten2dBy( x, [ 2, 2 ], false, scale );
-* // returns [ 2, 4, 6, 8 ]
-*
-* @example
-* var flatten2dBy = require( '@stdlib/array-base-flatten2d-by' );
-*
-* function scale( v ) {
-* return v * 2;
-* }
-*
-* var x = [ [ 1, 2 ], [ 3, 4 ] ];
-*
-* var out = flatten2dBy( x, [ 2, 2 ], true, scale );
-* // returns [ 2, 6, 4, 8 ]
-*
-* @example
-* var Float64Array = require( '@stdlib/array-float64' );
-* var flatten2dBy = require( '@stdlib/array-base-flatten2d-by' );
-*
-* function scale( v ) {
-* return v * 2;
-* }
-*
-* var x = [ [ 1, 2 ], [ 3, 4 ] ];
-*
-* var out = new Float64Array( 4 );
-* var y = flatten2dBy( x, [ 2, 2 ], true, out, 1, 0, scale );
-* // returns [ 2, 6, 4, 8 ]
-*
-* var bool = ( y === out );
-* // returns true
-*/
-
-// MODULES //
-
-var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );
-var main = require( './main.js' );
-var assign = require( './assign.js' );
-
-
-// MAIN //
-
-setReadOnly( main, 'assign', assign );
-
-
-// EXPORTS //
-
-module.exports = main;
diff --git a/lib/main.js b/lib/main.js
deleted file mode 100644
index 044ba56..0000000
--- a/lib/main.js
+++ /dev/null
@@ -1,93 +0,0 @@
-/**
-* @license Apache-2.0
-*
-* Copyright (c) 2023 The Stdlib Authors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-'use strict';
-
-// MAIN //
-
-/**
-* Flattens a two-dimensional nested array according to a callback function.
-*
-* ## Notes
-*
-* - The function assumes that all nested arrays have the same length (i.e., the input array is **not** a ragged array).
-*
-* @param {Array} x - input nested array
-* @param {NonNegativeIntegerArray} shape - array shape
-* @param {boolean} colexicographic - specifies whether to flatten array values in colexicographic order
-* @param {Function} clbk - callback function
-* @param {*} [thisArg] - callback execution context
-* @returns {Array} flattened array
-*
-* @example
-* function scale( v ) {
-* return v * 2;
-* }
-*
-* var x = [ [ 1, 2 ], [ 3, 4 ] ];
-*
-* var out = flatten2dBy( x, [ 2, 2 ], false, scale );
-* // returns [ 2, 4, 6, 8 ]
-*
-* @example
-* function scale( v ) {
-* return v * 2;
-* }
-*
-* var x = [ [ 1, 2 ], [ 3, 4 ] ];
-*
-* var out = flatten2dBy( x, [ 2, 2 ], true, scale );
-* // returns [ 2, 6, 4, 8 ]
-*/
-function flatten2dBy( x, shape, colexicographic, clbk, thisArg ) {
- var out;
- var S0;
- var S1;
- var i0;
- var i1;
- var a0;
-
- // Extract loop variables:
- S0 = shape[ 1 ]; // for nested arrays, the last dimensions have the fastest changing indices
- S1 = shape[ 0 ];
-
- // Initialize an output array:
- out = [];
-
- // Iterate over the array dimensions...
- if ( colexicographic ) {
- for ( i0 = 0; i0 < S0; i0++ ) {
- for ( i1 = 0; i1 < S1; i1++ ) {
- out.push( clbk.call( thisArg, x[ i1 ][ i0 ], [ i1, i0 ], x ) ); // equivalent to storing in column-major (Fortran-style) order
- }
- }
- return out;
- }
- for ( i1 = 0; i1 < S1; i1++ ) {
- a0 = x[ i1 ];
- for ( i0 = 0; i0 < S0; i0++ ) {
- out.push( clbk.call( thisArg, a0[ i0 ], [ i1, i0 ], x ) ); // equivalent to storing in row-major (C-style) order
- }
- }
- return out;
-}
-
-
-// EXPORTS //
-
-module.exports = flatten2dBy;
diff --git a/package.json b/package.json
index 775cbb7..723e5e9 100644
--- a/package.json
+++ b/package.json
@@ -3,31 +3,7 @@
"version": "0.2.2",
"description": "Flatten a two-dimensional nested array according to a callback function.",
"license": "Apache-2.0",
- "author": {
- "name": "The Stdlib Authors",
- "url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
- },
- "contributors": [
- {
- "name": "The Stdlib Authors",
- "url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
- }
- ],
- "main": "./lib",
- "directories": {
- "benchmark": "./benchmark",
- "doc": "./docs",
- "example": "./examples",
- "lib": "./lib",
- "test": "./test"
- },
- "types": "./docs/types",
- "scripts": {
- "test": "make test",
- "test-cov": "make test-cov",
- "examples": "make examples",
- "benchmark": "make benchmark"
- },
+ "main": "./index.js",
"homepage": "https://stdlib.io",
"repository": {
"type": "git",
@@ -36,39 +12,6 @@
"bugs": {
"url": "https://github.com/stdlib-js/stdlib/issues"
},
- "dependencies": {
- "@stdlib/types": "^0.4.3",
- "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2"
- },
- "devDependencies": {
- "@stdlib/array-base-filled": "^0.2.2",
- "@stdlib/array-base-zero-to": "^0.2.1",
- "@stdlib/array-float64": "^0.2.2",
- "@stdlib/assert-has-own-property": "^0.2.2",
- "@stdlib/assert-is-array": "^0.2.2",
- "@stdlib/assert-is-float64array": "^0.2.2",
- "@stdlib/math-base-special-abs": "^0.2.2",
- "@stdlib/utils-nary-function": "^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",
"utilities",
diff --git a/stats_browser.html b/stats_browser.html
new file mode 100644
index 0000000..7834360
--- /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..eeceae4
--- /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.assign.js b/test/test.assign.js
deleted file mode 100644
index 6c0c608..0000000
--- a/test/test.assign.js
+++ /dev/null
@@ -1,393 +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 naryFunction = require( '@stdlib/utils-nary-function' );
-var abs = require( '@stdlib/math-base-special-abs' );
-var Float64Array = require( '@stdlib/array-float64' );
-var flatten2dBy = require( './../lib/assign.js' );
-
-
-// VARIABLES //
-
-var clbk = naryFunction( abs, 1 );
-
-
-// TESTS //
-
-tape( 'main export is a function', function test( t ) {
- t.ok( true, __filename );
- t.strictEqual( typeof flatten2dBy, 'function', 'main export is a function' );
- t.end();
-});
-
-tape( 'the function flattens a nested array (lexicographic)', function test( t ) {
- var expected;
- var actual;
- var out;
- var x;
-
- x = [
- [ -1, -2, -3, -4 ],
- [ -5, -6, -7, -8 ],
- [ -9, -10, -11, -12 ],
- [ -13, -14, -15, -16 ]
- ];
-
- expected = new Float64Array( [] );
- out = new Float64Array( 0 );
- actual = flatten2dBy( x, [ 0, 0 ], false, out, 1, 0, clbk );
- t.strictEqual( actual, out, 'returns expected value' );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- expected = new Float64Array( [] );
- out = new Float64Array( 0 );
- actual = flatten2dBy( x, [ 0, 1 ], false, out, 1, 0, clbk );
- t.strictEqual( actual, out, 'returns expected value' );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- expected = new Float64Array( [] );
- out = new Float64Array( 0 );
- actual = flatten2dBy( x, [ 1, 0 ], false, out, 1, 0, clbk );
- t.strictEqual( actual, out, 'returns expected value' );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- expected = new Float64Array( [ 1 ] );
- out = new Float64Array( 1 );
- actual = flatten2dBy( x, [ 1, 1 ], false, out, 1, 0, clbk );
- t.strictEqual( actual, out, 'returns expected value' );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- expected = new Float64Array( [ 1, 2 ] );
- out = new Float64Array( 2 );
- actual = flatten2dBy( x, [ 1, 2 ], false, out, 1, 0, clbk );
- t.strictEqual( actual, out, 'returns expected value' );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- expected = new Float64Array( [ 1, 5 ] );
- out = new Float64Array( 2 );
- actual = flatten2dBy( x, [ 2, 1 ], false, out, 1, 0, clbk );
- t.strictEqual( actual, out, 'returns expected value' );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- expected = new Float64Array( [ 1, 2, 5, 6 ] );
- out = new Float64Array( 4 );
- actual = flatten2dBy( x, [ 2, 2 ], false, out, 1, 0, clbk );
- t.strictEqual( actual, out, 'returns expected value' );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- expected = new Float64Array( [ 1, 2, 3, 5, 6, 7 ] );
- out = new Float64Array( 6 );
- actual = flatten2dBy( x, [ 2, 3 ], false, out, 1, 0, clbk );
- t.strictEqual( actual, out, 'returns expected value' );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- expected = new Float64Array( [ 1, 2, 3, 5, 6, 7, 9, 10, 11 ] );
- out = new Float64Array( 9 );
- actual = flatten2dBy( x, [ 3, 3 ], false, out, 1, 0, clbk );
- t.strictEqual( actual, out, 'returns expected value' );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- expected = new Float64Array( [ 1, 5, 9, 13 ] );
- out = new Float64Array( 4 );
- actual = flatten2dBy( x, [ 4, 1 ], false, out, 1, 0, clbk );
- t.strictEqual( actual, out, 'returns expected value' );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- expected = new Float64Array( [ 1, 2, 5, 6, 9, 10, 13, 14 ] );
- out = new Float64Array( 8 );
- actual = flatten2dBy( x, [ 4, 2 ], false, out, 1, 0, clbk );
- t.strictEqual( actual, out, 'returns expected value' );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- expected = new Float64Array( [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 ] ); // eslint-disable-line max-len
- out = new Float64Array( 16 );
- actual = flatten2dBy( x, [ 4, 4 ], false, out, 1, 0, clbk );
- t.strictEqual( actual, out, 'returns expected value' );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- t.end();
-});
-
-tape( 'the function flattens a nested array (colexicographic)', function test( t ) {
- var expected;
- var actual;
- var out;
- var x;
-
- x = [
- [ -1, -2, -3, -4 ],
- [ -5, -6, -7, -8 ],
- [ -9, -10, -11, -12 ],
- [ -13, -14, -15, -16 ]
- ];
-
- expected = new Float64Array( [] );
- out = new Float64Array( 0 );
- actual = flatten2dBy( x, [ 0, 0 ], true, out, 1, 0, clbk );
- t.strictEqual( actual, out, 'returns expected value' );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- expected = new Float64Array( [] );
- out = new Float64Array( 0 );
- actual = flatten2dBy( x, [ 0, 1 ], true, out, 1, 0, clbk );
- t.strictEqual( actual, out, 'returns expected value' );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- expected = new Float64Array( [] );
- out = new Float64Array( 0 );
- actual = flatten2dBy( x, [ 1, 0 ], true, out, 1, 0, clbk );
- t.strictEqual( actual, out, 'returns expected value' );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- expected = new Float64Array( [ 1 ] );
- out = new Float64Array( 1 );
- actual = flatten2dBy( x, [ 1, 1 ], true, out, 1, 0, clbk );
- t.strictEqual( actual, out, 'returns expected value' );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- expected = new Float64Array( [ 1, 2 ] );
- out = new Float64Array( 2 );
- actual = flatten2dBy( x, [ 1, 2 ], true, out, 1, 0, clbk );
- t.strictEqual( actual, out, 'returns expected value' );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- expected = new Float64Array( [ 1, 5 ] );
- out = new Float64Array( 2 );
- actual = flatten2dBy( x, [ 2, 1 ], true, out, 1, 0, clbk );
- t.strictEqual( actual, out, 'returns expected value' );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- expected = new Float64Array( [ 1, 5, 2, 6 ] );
- out = new Float64Array( 4 );
- actual = flatten2dBy( x, [ 2, 2 ], true, out, 1, 0, clbk );
- t.strictEqual( actual, out, 'returns expected value' );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- expected = new Float64Array( [ 1, 5, 2, 6, 3, 7 ] );
- out = new Float64Array( 6 );
- actual = flatten2dBy( x, [ 2, 3 ], true, out, 1, 0, clbk );
- t.strictEqual( actual, out, 'returns expected value' );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- expected = new Float64Array( [ 1, 5, 9, 2, 6, 10, 3, 7, 11 ] );
- out = new Float64Array( 9 );
- actual = flatten2dBy( x, [ 3, 3 ], true, out, 1, 0, clbk );
- t.strictEqual( actual, out, 'returns expected value' );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- expected = new Float64Array( [ 1, 5, 9, 13 ] );
- out = new Float64Array( 4 );
- actual = flatten2dBy( x, [ 4, 1 ], true, out, 1, 0, clbk );
- t.strictEqual( actual, out, 'returns expected value' );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- expected = new Float64Array( [ 1, 5, 9, 13, 2, 6, 10, 14 ] );
- out = new Float64Array( 8 );
- actual = flatten2dBy( x, [ 4, 2 ], true, out, 1, 0, clbk );
- t.strictEqual( actual, out, 'returns expected value' );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- expected = new Float64Array( [ 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15, 4, 8, 12, 16 ] ); // eslint-disable-line max-len
- out = new Float64Array( 16 );
- actual = flatten2dBy( x, [ 4, 4 ], true, out, 1, 0, clbk );
- t.strictEqual( actual, out, 'returns expected value' );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- t.end();
-});
-
-tape( 'the function supports providing a stride (lexicographic)', function test( t ) {
- var expected;
- var actual;
- var out;
- var x;
-
- x = [
- [ -1, -2 ],
- [ -3, -4 ]
- ];
-
- expected = new Float64Array( [ 1, 0, 2, 0, 3, 0, 4, 0 ] );
- out = new Float64Array( 8 );
- actual = flatten2dBy( x, [ 2, 2 ], false, out, 2, 0, clbk );
- t.strictEqual( actual, out, 'returns expected value' );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- t.end();
-});
-
-tape( 'the function supports providing a stride (colexicographic)', function test( t ) {
- var expected;
- var actual;
- var out;
- var x;
-
- x = [
- [ -1, -2 ],
- [ -3, -4 ]
- ];
-
- expected = new Float64Array( [ 1, 0, 3, 0, 2, 0, 4, 0 ] );
- out = new Float64Array( 8 );
- actual = flatten2dBy( x, [ 2, 2 ], true, out, 2, 0, clbk );
- t.strictEqual( actual, out, 'returns expected value' );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- t.end();
-});
-
-tape( 'the function supports providing an offset (lexicographic)', function test( t ) {
- var expected;
- var actual;
- var out;
- var x;
-
- x = [
- [ -1, -2 ],
- [ -3, -4 ]
- ];
-
- expected = new Float64Array( [ 0, 0, 1, 2, 3, 4, 0, 0 ] );
- out = new Float64Array( 8 );
- actual = flatten2dBy( x, [ 2, 2 ], false, out, 1, 2, clbk );
- t.strictEqual( actual, out, 'returns expected value' );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- t.end();
-});
-
-tape( 'the function supports providing an offset (colexicographic)', function test( t ) {
- var expected;
- var actual;
- var out;
- var x;
-
- x = [
- [ -1, -2 ],
- [ -3, -4 ]
- ];
-
- expected = new Float64Array( [ 0, 0, 1, 3, 2, 4, 0, 0 ] );
- out = new Float64Array( 8 );
- actual = flatten2dBy( x, [ 2, 2 ], true, out, 1, 2, clbk );
- t.strictEqual( actual, out, 'returns expected value' );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- t.end();
-});
-
-tape( 'the function supports complex access patterns (lexicographic)', function test( t ) {
- var expected;
- var actual;
- var out;
- var x;
-
- x = [
- [ -1, -2 ],
- [ -3, -4 ]
- ];
-
- expected = new Float64Array( [ 0, 4, 0, 3, 0, 2, 0, 1 ] );
- out = new Float64Array( 8 );
- actual = flatten2dBy( x, [ 2, 2 ], false, out, -2, 7, clbk );
- t.strictEqual( actual, out, 'returns expected value' );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- t.end();
-});
-
-tape( 'the function supports complex access patterns (colexicographic)', function test( t ) {
- var expected;
- var actual;
- var out;
- var x;
-
- x = [
- [ -1, -2 ],
- [ -3, -4 ]
- ];
-
- expected = new Float64Array( [ 0, 4, 0, 2, 0, 3, 0, 1 ] );
- out = new Float64Array( 8 );
- actual = flatten2dBy( x, [ 2, 2 ], true, out, -2, 7, clbk );
- t.strictEqual( actual, out, 'returns expected value' );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- t.end();
-});
-
-tape( 'the function supports setting the callback execution context (lexicographic)', function test( t ) {
- var ctx;
- var out;
- var x;
-
- x = [
- [ 1, 2 ],
- [ 3, 4 ]
- ];
-
- ctx = {
- 'count': 0
- };
-
- out = new Float64Array( 4 );
- flatten2dBy( x, [ 2, 2 ], false, out, 1, 0, fcn, ctx );
- t.strictEqual( ctx.count, 4, 'returns expected value' );
-
- t.end();
-
- function fcn( value, indices, arr ) {
- this.count += 1; // eslint-disable-line no-invalid-this
- t.strictEqual( indices.length, 2, 'returns expected value' );
- t.strictEqual( value, arr[ indices[0] ][ indices[1] ], 'returns expected value' );
- t.strictEqual( arr, x, 'returns expected value' );
- }
-});
-
-tape( 'the function supports setting the callback execution context (colexicographic)', function test( t ) {
- var ctx;
- var out;
- var x;
-
- x = [
- [ 1, 2 ],
- [ 3, 4 ]
- ];
-
- ctx = {
- 'count': 0
- };
-
- out = new Float64Array( 4 );
- flatten2dBy( x, [ 2, 2 ], true, out, 1, 0, fcn, ctx );
- t.strictEqual( ctx.count, 4, 'returns expected value' );
-
- t.end();
-
- function fcn( value, indices, arr ) {
- this.count += 1; // eslint-disable-line no-invalid-this
- t.strictEqual( indices.length, 2, 'returns expected value' );
- t.strictEqual( value, arr[ indices[0] ][ indices[1] ], 'returns expected value' );
- t.strictEqual( arr, x, 'returns expected value' );
- }
-});
diff --git a/test/test.js b/test/test.js
deleted file mode 100644
index 6234f4f..0000000
--- a/test/test.js
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
-* @license Apache-2.0
-*
-* Copyright (c) 2023 The Stdlib Authors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-'use strict';
-
-// MODULES //
-
-var tape = require( 'tape' );
-var hasOwnProp = require( '@stdlib/assert-has-own-property' );
-var flatten2dBy = require( './../lib' );
-
-
-// TESTS //
-
-tape( 'main export is a function', function test( t ) {
- t.ok( true, __filename );
- t.strictEqual( typeof flatten2dBy, 'function', 'main export is a function' );
- t.end();
-});
-
-tape( 'attached to the main export is an `assign` method', function test( t ) {
- t.strictEqual( hasOwnProp( flatten2dBy, 'assign' ), true, 'has property' );
- t.strictEqual( typeof flatten2dBy.assign, 'function', 'has method' );
- t.end();
-});
diff --git a/test/test.main.js b/test/test.main.js
deleted file mode 100644
index a99f230..0000000
--- a/test/test.main.js
+++ /dev/null
@@ -1,218 +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 naryFunction = require( '@stdlib/utils-nary-function' );
-var abs = require( '@stdlib/math-base-special-abs' );
-var flatten2dBy = require( './../lib/main.js' );
-
-
-// VARIABLES //
-
-var clbk = naryFunction( abs, 1 );
-
-
-// TESTS //
-
-tape( 'main export is a function', function test( t ) {
- t.ok( true, __filename );
- t.strictEqual( typeof flatten2dBy, 'function', 'main export is a function' );
- t.end();
-});
-
-tape( 'the function flattens a nested array (lexicographic)', function test( t ) {
- var expected;
- var actual;
- var x;
-
- x = [
- [ -1, -2, -3, -4 ],
- [ -5, -6, -7, -8 ],
- [ -9, -10, -11, -12 ],
- [ -13, -14, -15, -16 ]
- ];
-
- expected = [];
- actual = flatten2dBy( x, [ 0, 0 ], false, clbk );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- expected = [];
- actual = flatten2dBy( x, [ 0, 1 ], false, clbk );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- expected = [];
- actual = flatten2dBy( x, [ 1, 0 ], false, clbk );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- expected = [ 1 ];
- actual = flatten2dBy( x, [ 1, 1 ], false, clbk );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- expected = [ 1, 2 ];
- actual = flatten2dBy( x, [ 1, 2 ], false, clbk );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- expected = [ 1, 5 ];
- actual = flatten2dBy( x, [ 2, 1 ], false, clbk );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- expected = [ 1, 2, 5, 6 ];
- actual = flatten2dBy( x, [ 2, 2 ], false, clbk );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- expected = [ 1, 2, 3, 5, 6, 7 ];
- actual = flatten2dBy( x, [ 2, 3 ], false, clbk );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- expected = [ 1, 2, 3, 5, 6, 7, 9, 10, 11 ];
- actual = flatten2dBy( x, [ 3, 3 ], false, clbk );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- expected = [ 1, 5, 9, 13 ];
- actual = flatten2dBy( x, [ 4, 1 ], false, clbk );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- expected = [ 1, 2, 5, 6, 9, 10, 13, 14 ];
- actual = flatten2dBy( x, [ 4, 2 ], false, clbk );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- expected = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 ];
- actual = flatten2dBy( x, [ 4, 4 ], false, clbk );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- t.end();
-});
-
-tape( 'the function flattens a nested array (colexicographic)', function test( t ) {
- var expected;
- var actual;
- var x;
-
- x = [
- [ -1, -2, -3, -4 ],
- [ -5, -6, -7, -8 ],
- [ -9, -10, -11, -12 ],
- [ -13, -14, -15, -16 ]
- ];
-
- expected = [];
- actual = flatten2dBy( x, [ 0, 0 ], true, clbk );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- expected = [];
- actual = flatten2dBy( x, [ 0, 1 ], true, clbk );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- expected = [];
- actual = flatten2dBy( x, [ 1, 0 ], true, clbk );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- expected = [ 1 ];
- actual = flatten2dBy( x, [ 1, 1 ], true, clbk );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- expected = [ 1, 2 ];
- actual = flatten2dBy( x, [ 1, 2 ], true, clbk );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- expected = [ 1, 5 ];
- actual = flatten2dBy( x, [ 2, 1 ], true, clbk );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- expected = [ 1, 5, 2, 6 ];
- actual = flatten2dBy( x, [ 2, 2 ], true, clbk );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- expected = [ 1, 5, 2, 6, 3, 7 ];
- actual = flatten2dBy( x, [ 2, 3 ], true, clbk );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- expected = [ 1, 5, 9, 2, 6, 10, 3, 7, 11 ];
- actual = flatten2dBy( x, [ 3, 3 ], true, clbk );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- expected = [ 1, 5, 9, 13 ];
- actual = flatten2dBy( x, [ 4, 1 ], true, clbk );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- expected = [ 1, 5, 9, 13, 2, 6, 10, 14 ];
- actual = flatten2dBy( x, [ 4, 2 ], true, clbk );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- expected = [ 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15, 4, 8, 12, 16 ];
- actual = flatten2dBy( x, [ 4, 4 ], true, clbk );
- t.deepEqual( actual, expected, 'returns expected value' );
-
- t.end();
-});
-
-tape( 'the function supports setting the callback execution context (lexicographic)', function test( t ) {
- var ctx;
- var x;
-
- x = [
- [ 1, 2 ],
- [ 3, 4 ]
- ];
-
- ctx = {
- 'count': 0
- };
-
- flatten2dBy( x, [ 2, 2 ], false, fcn, ctx );
- t.strictEqual( ctx.count, 4, 'returns expected value' );
-
- t.end();
-
- function fcn( value, indices, arr ) {
- this.count += 1; // eslint-disable-line no-invalid-this
- t.strictEqual( indices.length, 2, 'returns expected value' );
- t.strictEqual( value, arr[ indices[0] ][ indices[1] ], 'returns expected value' );
- t.strictEqual( arr, x, 'returns expected value' );
- }
-});
-
-tape( 'the function supports setting the callback execution context (colexicographic)', function test( t ) {
- var ctx;
- var x;
-
- x = [
- [ 1, 2 ],
- [ 3, 4 ]
- ];
-
- ctx = {
- 'count': 0
- };
-
- flatten2dBy( x, [ 2, 2 ], true, fcn, ctx );
- t.strictEqual( ctx.count, 4, 'returns expected value' );
-
- t.end();
-
- function fcn( value, indices, arr ) {
- this.count += 1; // eslint-disable-line no-invalid-this
- t.strictEqual( indices.length, 2, 'returns expected value' );
- t.strictEqual( value, arr[ indices[0] ][ indices[1] ], 'returns expected value' );
- t.strictEqual( arr, x, 'returns expected value' );
- }
-});