From 74c2f9cb6b56187bf57a8499ec0eff25165d694b Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 28 Sep 2023 00:52:58 +0000 Subject: [PATCH] Auto-generated commit --- .github/workflows/benchmark.yml | 6 +- .github/workflows/cancel.yml | 3 +- .github/workflows/close_pull_requests.yml | 36 +- .github/workflows/examples.yml | 10 +- .github/workflows/npm_downloads.yml | 12 +- .github/workflows/productionize.yml | 42 +- .github/workflows/publish.yml | 15 +- .github/workflows/test.yml | 9 +- .github/workflows/test_bundles.yml | 27 +- .github/workflows/test_coverage.yml | 15 +- .github/workflows/test_install.yml | 9 +- README.md | 4 +- dist/index.js | 2 +- dist/index.js.map | 4 +- lib/main.js | 2 +- package.json | 4 +- test/dist/test.js | 1041 +++++++++++++++++++++ 17 files changed, 1170 insertions(+), 71 deletions(-) create mode 100644 test/dist/test.js diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 06a9a75..ab56cca 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -41,11 +41,13 @@ jobs: # Checkout the repository: - name: 'Checkout repository' - uses: actions/checkout@v3 + # Pin action to full length commit SHA corresponding to v4.1.0 + uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # Install Node.js: - name: 'Install Node.js' - uses: actions/setup-node@v3 + # Pin action to full length commit SHA corresponding to v3.8.1 + uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d with: node-version: 16 timeout-minutes: 5 diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml index a00dbe5..3acd3a9 100644 --- a/.github/workflows/cancel.yml +++ b/.github/workflows/cancel.yml @@ -44,7 +44,8 @@ jobs: # Cancel existing workflow runs: - name: 'Cancel existing workflow runs' - uses: styfle/cancel-workflow-action@0.11.0 + # Pin action to full length commit SHA corresponding to v0.11.0 + uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 with: workflow_id: >- benchmark.yml, diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml index 468b9c0..800993d 100644 --- a/.github/workflows/close_pull_requests.yml +++ b/.github/workflows/close_pull_requests.yml @@ -26,19 +26,29 @@ on: # 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: - - uses: superbrothers/close-pull-request@v3 - 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/slice/multi) 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 + + # 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/slice/multi) 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 index 7902a7d..c1c45e7 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -39,13 +39,15 @@ jobs: # Define the sequence of job steps... steps: - # Checkout the repository: - - name: 'Checkout the repository' - uses: actions/checkout@v3 + # Checkout repository: + - name: 'Checkout repository' + # Pin action to full length commit SHA corresponding to v4.1.0 + uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # Install Node.js: - name: 'Install Node.js' - uses: actions/setup-node@v3 + # Pin action to full length commit SHA corresponding to v3.8.1 + uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d with: node-version: 16 timeout-minutes: 5 diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml index 9751efc..789dcb6 100644 --- a/.github/workflows/npm_downloads.yml +++ b/.github/workflows/npm_downloads.yml @@ -45,12 +45,14 @@ jobs: steps: # Checkout the repository: - name: 'Checkout repository' - uses: actions/checkout@v3 + # Pin action to full length commit SHA corresponding to v4.1.0 + uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 timeout-minutes: 10 # Install Node.js: - name: 'Install Node.js' - uses: actions/setup-node@v3 + # Pin action to full length commit SHA corresponding to v3.8.1 + uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d with: node-version: 16 timeout-minutes: 5 @@ -84,7 +86,8 @@ jobs: # Upload the download data: - name: 'Upload data' - uses: actions/upload-artifact@v3 + # Pin action to full length commit SHA corresponding to v3.1.3 + uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 with: # Define a name for the uploaded artifact (ensuring a unique name for each job): name: npm_downloads @@ -99,7 +102,8 @@ jobs: # Send data to events server: - name: 'Post data' - uses: distributhor/workflow-webhook@v3 + # Pin action to full length commit SHA corresponding to v3.0.3: + uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 env: webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml index 91f2b93..265afda 100644 --- a/.github/workflows/productionize.yml +++ b/.github/workflows/productionize.yml @@ -61,13 +61,15 @@ jobs: steps: # Checkout main branch of repository: - name: 'Checkout main branch' - uses: actions/checkout@v3 + # Pin action to full length commit SHA corresponding to v4.1.0 + uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 with: ref: main # Install Node.js: - name: 'Install Node.js' - uses: actions/setup-node@v3 + # Pin action to full length commit SHA corresponding to v3.8.1 + uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d with: node-version: 16 timeout-minutes: 5 @@ -132,7 +134,8 @@ jobs: # Checkout the repository: - name: 'Checkout repository' if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/checkout@v3 + # Pin action to full length commit SHA corresponding to v4.1.0 + uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 with: # Use the `production` branch: ref: production @@ -140,7 +143,8 @@ jobs: # Install Node.js: - name: 'Install Node.js' if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/setup-node@v3 + # Pin action to full length commit SHA corresponding to v3.8.1 + uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d with: node-version: 16 timeout-minutes: 5 @@ -184,7 +188,8 @@ jobs: steps: # Checkout the repository: - name: 'Checkout repository' - uses: actions/checkout@v3 + # Pin action to full length commit SHA corresponding to v4.1.0 + uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # Configure git: - name: 'Configure git' @@ -251,7 +256,8 @@ jobs: # Install Node.js: - name: 'Install Node.js' - uses: actions/setup-node@v3 + # Pin action to full length commit SHA corresponding to v3.8.1 + uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d with: node-version: 16 timeout-minutes: 5 @@ -334,7 +340,8 @@ jobs: # Send status to Slack channel if job fails: - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v2 + # Pin action to full length commit SHA corresponding to v2.0.0 + uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f with: status: ${{ job.status }} steps: ${{ toJson(steps) }} @@ -357,7 +364,8 @@ jobs: steps: # Checkout the repository: - name: 'Checkout repository' - uses: actions/checkout@v3 + # Pin action to full length commit SHA corresponding to v4.1.0 + uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # Configure git: - name: 'Configure git' @@ -416,7 +424,8 @@ jobs: # Install Node.js - name: 'Install Node.js' - uses: actions/setup-node@v3 + # Pin action to full length commit SHA corresponding to v3.8.1 + uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d with: node-version: 16 timeout-minutes: 5 @@ -505,7 +514,8 @@ jobs: # Send status to Slack channel if job fails: - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v2 + # Pin action to full length commit SHA corresponding to v2.0.0 + uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f with: status: ${{ job.status }} steps: ${{ toJson(steps) }} @@ -528,7 +538,8 @@ jobs: steps: # Checkout the repository: - name: 'Checkout repository' - uses: actions/checkout@v3 + # Pin action to full length commit SHA corresponding to v4.1.0 + uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # Configure git: - name: 'Configure git' @@ -595,7 +606,8 @@ jobs: # Install Node.js: - name: 'Install Node.js' - uses: actions/setup-node@v3 + # Pin action to full length commit SHA corresponding to v3.8.1 + uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d with: node-version: 16 timeout-minutes: 5 @@ -682,7 +694,8 @@ jobs: # Send status to Slack channel if job fails: - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v2 + # Pin action to full length commit SHA corresponding to v2.0.0 + uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f with: status: ${{ job.status }} steps: ${{ toJson(steps) }} @@ -706,7 +719,8 @@ jobs: # Checkout the repository: - name: 'Checkout repository' - uses: actions/checkout@v3 + # Pin action to full length commit SHA corresponding to v4.1.0 + uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 with: fetch-depth: 2 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 474004b..b17435b 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -61,11 +61,13 @@ jobs: # Checkout the repository: - name: 'Checkout repository' - uses: actions/checkout@v3 + # Pin action to full length commit SHA corresponding to v4.1.0 + uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # Install Node.js: - name: 'Install Node.js' - uses: actions/setup-node@v3 + # Pin action to full length commit SHA corresponding to v3.8.1 + uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d with: node-version: 16 timeout-minutes: 5 @@ -197,7 +199,8 @@ jobs: # Publish package to npm: - name: 'Publish package to npm' - uses: JS-DevTools/npm-publish@v2 + # Pin action to full length commit SHA corresponding to v2.2.2 + uses: JS-DevTools/npm-publish@fe72237be0920f7a0cafd6a966c9b929c9466e9b with: token: ${{ secrets.NPM_TOKEN }} access: public @@ -209,7 +212,8 @@ jobs: # Send status to Slack channel if job fails: - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v2 + # Pin action to full length commit SHA corresponding to v2.0.0 + uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f with: status: ${{ job.status }} steps: ${{ toJson(steps) }} @@ -230,7 +234,8 @@ jobs: # Cancel any running or queued workflow runs: - name: 'Cancel running or queued workflow runs' - uses: styfle/cancel-workflow-action@0.11.0 + # Pin action to full length commit SHA corresponding to v0.11.0 + uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 with: workflow_id: >- benchmark.yml, diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fb614e0..a6d4382 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -58,11 +58,13 @@ jobs: # Checkout the repository: - name: 'Checkout repository' - uses: actions/checkout@v3 + # Pin action to full length commit SHA corresponding to v4.1.0 + uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # Install Node.js: - name: 'Install Node.js' - uses: actions/setup-node@v3 + # Pin action to full length commit SHA corresponding to v3.8.1 + uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d with: node-version: 16 timeout-minutes: 5 @@ -89,7 +91,8 @@ jobs: # Send status to Slack channel if job fails: - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v2 + # Pin action to full length commit SHA corresponding to v2.0.0 + uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f with: status: ${{ job.status }} steps: ${{ toJson(steps) }} diff --git a/.github/workflows/test_bundles.yml b/.github/workflows/test_bundles.yml index 172cb2d..0d26143 100644 --- a/.github/workflows/test_bundles.yml +++ b/.github/workflows/test_bundles.yml @@ -49,13 +49,15 @@ jobs: steps: # Checkout UMD branch of the repository: - name: 'Checkout branch with UMD build' - uses: actions/checkout@v3 + # Pin action to full length commit SHA corresponding to v4.1.0 + uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 with: ref: umd # Install Node.js: - name: 'Install Node.js' - uses: actions/setup-node@v3 + # Pin action to full length commit SHA corresponding to v3.8.1 + uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d with: node-version: 17 @@ -88,7 +90,8 @@ jobs: # Send notification to Slack channel if job fails: - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v2 + # Pin action to full length commit SHA corresponding to v2.0.0 + uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f with: status: ${{ job.status }} steps: ${{ toJson(steps) }} @@ -113,13 +116,15 @@ jobs: # Checkout ES modules branch of the repository: - name: 'Checkout branch with ESM build' - uses: actions/checkout@v3 + # Pin action to full length commit SHA corresponding to v4.1.0 + uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 with: ref: esm # Install Node.js: - name: 'Install Node.js' - uses: actions/setup-node@v3 + # Pin action to full length commit SHA corresponding to v3.8.1 + uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d with: node-version: 17 @@ -130,7 +135,8 @@ jobs: # Send notification to Slack channel if job fails: - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v2 + # Pin action to full length commit SHA corresponding to v2.0.0 + uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f with: status: ${{ job.status }} steps: ${{ toJson(steps) }} @@ -155,13 +161,15 @@ jobs: # Checkout Deno branch of the repository: - name: 'Checkout branch with Deno build' - uses: actions/checkout@v3 + # Pin action to full length commit SHA corresponding to v4.1.0 + uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 with: ref: deno # Install Deno: - name: 'Install Deno' - uses: denoland/setup-deno@v1 + # Pin action to full length commit SHA corresponding to v1.1.2 + uses: denoland/setup-deno@61fe2df320078202e33d7d5ad347e7dcfa0e8f31 with: deno-version: vx.x.x @@ -172,7 +180,8 @@ jobs: # Send notification to Slack channel if job fails: - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v2 + # Pin action to full length commit SHA corresponding to v2.0.0 + uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f with: status: ${{ job.status }} steps: ${{ toJson(steps) }} diff --git a/.github/workflows/test_coverage.yml b/.github/workflows/test_coverage.yml index a73c515..5b2b1ea 100644 --- a/.github/workflows/test_coverage.yml +++ b/.github/workflows/test_coverage.yml @@ -46,11 +46,13 @@ jobs: # Checkout the repository: - name: 'Checkout repository' - uses: actions/checkout@v3 + # Pin action to full length commit SHA corresponding to v4.1.0 + uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # Install Node.js: - name: 'Install Node.js' - uses: actions/setup-node@v3 + # Pin action to full length commit SHA corresponding to v3.8.1 + uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d with: node-version: 16 timeout-minutes: 5 @@ -77,7 +79,8 @@ jobs: # Upload coverage report to Codecov: - name: 'Upload coverage to Codecov' id: upload - uses: codecov/codecov-action@v3 + # Pin action to full length commit SHA corresponding to v3.1.4 + uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d with: directory: reports/coverage flags: unittests @@ -106,7 +109,8 @@ jobs: # Send Slack notification if job fails: - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v2 + # Pin action to full length commit SHA corresponding to v2.0.0 + uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f with: status: ${{ job.status }} steps: ${{ toJson(steps) }} @@ -115,7 +119,8 @@ jobs: # Send data to events server: - name: 'Post data' - uses: distributhor/workflow-webhook@v3 + # Pin action to full length commit SHA corresponding to v3.0.3: + uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 env: webhook_url: ${{ secrets.STDLIB_COVERAGE_URL }} webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} diff --git a/.github/workflows/test_install.yml b/.github/workflows/test_install.yml index 95e2ab3..7272399 100644 --- a/.github/workflows/test_install.yml +++ b/.github/workflows/test_install.yml @@ -58,11 +58,13 @@ jobs: # Checkout the repository: - name: 'Checkout repository' - uses: actions/checkout@v3 + # Pin action to full length commit SHA corresponding to v4.1.0 + uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # Install Node.js: - name: 'Install Node.js' - uses: actions/setup-node@v3 + # Pin action to full length commit SHA corresponding to v3.8.1 + uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d with: node-version: 16 timeout-minutes: 5 @@ -75,7 +77,8 @@ jobs: # Send Slack notification if job fails: - name: 'Send notification to Slack in case of failure' - uses: act10ns/slack@v2 + # Pin action to full length commit SHA corresponding to v2.0.0 + uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f with: status: ${{ job.status }} steps: ${{ toJson(steps) }} diff --git a/README.md b/README.md index 122000e..6961230 100644 --- a/README.md +++ b/README.md @@ -300,8 +300,8 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. [npm-image]: http://img.shields.io/npm/v/@stdlib/slice-multi.svg [npm-url]: https://npmjs.org/package/@stdlib/slice-multi -[test-image]: https://github.com/stdlib-js/slice-multi/actions/workflows/test.yml/badge.svg?branch=v0.1.0 -[test-url]: https://github.com/stdlib-js/slice-multi/actions/workflows/test.yml?query=branch:v0.1.0 +[test-image]: https://github.com/stdlib-js/slice-multi/actions/workflows/test.yml/badge.svg?branch=main +[test-url]: https://github.com/stdlib-js/slice-multi/actions/workflows/test.yml?query=branch:main [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/slice-multi/main.svg [coverage-url]: https://codecov.io/github/stdlib-js/slice-multi?branch=main diff --git a/dist/index.js b/dist/index.js index 47e0438..5d53ff9 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,5 +1,5 @@ "use strict";var m=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var g=m(function(y,o){ -var u=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),s=require('@stdlib/utils-define-nonenumerable-read-only-accessor/dist'),d=require('@stdlib/assert-is-integer/dist').isPrimitive,l=require('@stdlib/assert-is-null/dist'),f=require('@stdlib/assert-is-undefined/dist'),v=require('@stdlib/assert-is-slice/dist'),p=require('@stdlib/error-tools-fmtprodmsg/dist');function c(r){return d(r)||l(r)||f(r)||v(r)}function a(){var r,e,i,t,n;if(r=arguments.length,!(this instanceof a)){if(r===1)return new a(arguments[0]);if(r===2)return new a(arguments[0],arguments[1]);if(r===3)return new a(arguments[0],arguments[1],arguments[2]);if(r===4)return new a(arguments[0],arguments[1],arguments[2],arguments[3]);if(r===5)return new a(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4]);for(i=[],n=0;n\n*/\nfunction MultiSlice() {\n\tvar nargs;\n\tvar proxy;\n\tvar args;\n\tvar v;\n\tvar i;\n\n\tnargs = arguments.length;\n\tif ( !( this instanceof MultiSlice ) ) {\n\t\tif ( nargs === 1 ) {\n\t\t\treturn new MultiSlice( arguments[ 0 ] );\n\t\t}\n\t\tif ( nargs === 2 ) {\n\t\t\treturn new MultiSlice( arguments[ 0 ], arguments[ 1 ] );\n\t\t}\n\t\tif ( nargs === 3 ) {\n\t\t\treturn new MultiSlice( arguments[ 0 ], arguments[ 1 ], arguments[ 2 ] ); // eslint-disable-line max-len\n\t\t}\n\t\tif ( nargs === 4 ) {\n\t\t\treturn new MultiSlice( arguments[ 0 ], arguments[ 1 ], arguments[ 2 ], arguments[ 3 ] ); // eslint-disable-line max-len\n\t\t}\n\t\tif ( nargs === 5 ) {\n\t\t\treturn new MultiSlice( arguments[ 0 ], arguments[ 1 ], arguments[ 2 ], arguments[ 3 ], arguments[ 4 ] ); // eslint-disable-line max-len\n\t\t}\n\t\targs = [];\n\t\tfor ( i = 0; i < nargs; i++ ) {\n\t\t\targs.push( arguments[ i ] );\n\t\t}\n\t\t// Use a workaround for being unable to combine `.apply` with the `new` operator:\n\t\tproxy = Object.create( MultiSlice.prototype );\n\t\treturn MultiSlice.apply( proxy, args );\n\t}\n\tthis._data = [];\n\tfor ( i = 0; i < nargs; i++ ) {\n\t\tv = arguments[ i ];\n\t\tif ( !isValid( v ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Provided arguments must be either a Slice, integer, null, or undefined. Argument: `%d`. Value: `%s`.', i, v ) );\n\t\t}\n\t\tthis._data.push( ( v === void 0 ) ? null : v );\n\t}\n\treturn this;\n}\n\n/**\n* Constructor name.\n*\n* @name name\n* @memberof MultiSlice\n* @readonly\n* @type {string}\n* @default 'MultiSlice'\n*\n* @example\n* var str = MultiSlice.name;\n* // returns 'MultiSlice'\n*/\nsetReadOnly( MultiSlice, 'name', 'MultiSlice' );\n\n/**\n* Returns the number of slice dimensions.\n*\n* @name ndims\n* @memberof MultiSlice.prototype\n* @readonly\n* @type {NonNegativeInteger}\n*\n* @example\n* var Slice = require( '@stdlib/slice-ctor' );\n*\n* var s1 = new Slice( 0, 10, 1 );\n* var s2 = new Slice( 2, 12, 2 );\n*\n* var ms = new MultiSlice( null, s1, s2, 2 );\n* // returns \n*\n* var ndims = ms.ndims;\n* // returns 4\n*/\nsetReadOnlyAccessor( MultiSlice.prototype, 'ndims', function get() {\n\treturn this._data.length;\n});\n\n/**\n* Returns multi-slice data.\n*\n* @name data\n* @memberof MultiSlice.prototype\n* @readonly\n* @type {Array}\n*\n* @example\n* var Slice = require( '@stdlib/slice-ctor' );\n*\n* var s1 = new Slice( 0, 10, 1 );\n* var s2 = new Slice( 2, 12, 2 );\n*\n* var ms = new MultiSlice( null, s1, s2, 2 );\n* // returns \n*\n* var data = ms.data;\n* // returns [...]\n*\n* var v = data[ 0 ];\n* // returns null\n*\n* v = data[ 1 ];\n* // returns \n*\n* v = data[ 2 ];\n* // returns \n*\n* v = data[ 3 ];\n* // returns 2\n*/\nsetReadOnlyAccessor( MultiSlice.prototype, 'data', function get() {\n\treturn this._data.slice();\n});\n\n/**\n* Serializes a multi-slice to a string.\n*\n* @name toString\n* @memberof MultiSlice.prototype\n* @type {Function}\n* @returns {string} serialized MultiSlice\n*\n* @example\n* var Slice = require( '@stdlib/slice-ctor' );\n*\n* var s1 = new Slice( 0, 10, 1 );\n* var s2 = new Slice( 2, 12, 2 );\n*\n* var ms = new MultiSlice( null, s1, s2, 2 );\n* // returns \n*\n* var str = ms.toString();\n* // returns 'MultiSlice(null,Slice(0,10,1),Slice(2,12,2),2)'\n*/\nsetReadOnly( MultiSlice.prototype, 'toString', function toString() {\n\tvar data;\n\tvar out;\n\tvar i;\n\n\tdata = this._data;\n\tout = [];\n\tfor ( i = 0; i < data.length; i++ ) {\n\t\tout.push( String( data[ i ] ) );\n\t}\n\treturn 'MultiSlice('+out.join( ',' )+')';\n});\n\n/**\n* Serializes a multi-slice as a JSON object.\n*\n* ## Notes\n*\n* - `JSON.stringify()` implicitly calls this method when stringifying a `MultiSlice` instance.\n*\n* @name toString\n* @memberof MultiSlice.prototype\n* @type {Function}\n* @returns {Object} serialized MultiSlice\n*\n* @example\n* var Slice = require( '@stdlib/slice-ctor' );\n*\n* var s1 = new Slice( 0, 10, 1 );\n* var s2 = new Slice( 2, 12, 2 );\n*\n* var ms = new MultiSlice( null, s1, s2, 2 );\n* // returns \n*\n* var o = ms.toJSON();\n* // returns { 'type': 'MultiSlice', 'data': [ null, { 'type': 'Slice', 'data': [ 0, 10, 1 ] }, { 'type': 'Slice', 'data': [ 2, 12, 2 ] }, 2 ] }\n*/\nsetReadOnly( MultiSlice.prototype, 'toJSON', function toJSON() {\n\tvar data;\n\tvar out;\n\tvar v;\n\tvar i;\n\n\tdata = this._data;\n\tout = {\n\t\t'type': 'MultiSlice',\n\t\t'data': []\n\t};\n\tfor ( i = 0; i < data.length; i++ ) {\n\t\tv = data[ i ];\n\t\tout.data.push( ( v && typeof v.toJSON === 'function' ) ? v.toJSON() : v );\n\t}\n\treturn out;\n});\n\n\n// EXPORTS //\n\nmodule.exports = MultiSlice;\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* Multi-slice constructor.\n*\n* @module @stdlib/slice-multi\n*\n* @example\n* var Slice = require( '@stdlib/slice-ctor' );\n* var MultiSlice = require( '@stdlib/slice-multi' );\n*\n* var s1 = new Slice( 0, 10, 1 );\n* var s2 = new Slice( 2, 12, 2 );\n*\n* var ms = new MultiSlice( null, s1, s2, 2 );\n* // returns \n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAwBA,IAAIC,EAAc,QAAS,uDAAwD,EAC/EC,EAAsB,QAAS,uDAAwD,EACvFC,EAAY,QAAS,2BAA4B,EAAE,YACnDC,EAAS,QAAS,wBAAyB,EAC3CC,EAAc,QAAS,6BAA8B,EACrDC,EAAU,QAAS,yBAA0B,EAC7CC,EAAS,QAAS,uBAAwB,EAyB9C,SAASC,EAASC,EAAQ,CACzB,OACCN,EAAWM,CAAM,GACjBL,EAAQK,CAAM,GACdJ,EAAaI,CAAM,GACnBH,EAASG,CAAM,CAEjB,CAsBA,SAASC,GAAa,CACrB,IAAIC,EACAC,EACAC,EACAC,EACAC,EAGJ,GADAJ,EAAQ,UAAU,OACb,EAAG,gBAAgBD,GAAe,CACtC,GAAKC,IAAU,EACd,OAAO,IAAID,EAAY,UAAW,CAAE,CAAE,EAEvC,GAAKC,IAAU,EACd,OAAO,IAAID,EAAY,UAAW,CAAE,EAAG,UAAW,CAAE,CAAE,EAEvD,GAAKC,IAAU,EACd,OAAO,IAAID,EAAY,UAAW,CAAE,EAAG,UAAW,CAAE,EAAG,UAAW,CAAE,CAAE,EAEvE,GAAKC,IAAU,EACd,OAAO,IAAID,EAAY,UAAW,CAAE,EAAG,UAAW,CAAE,EAAG,UAAW,CAAE,EAAG,UAAW,CAAE,CAAE,EAEvF,GAAKC,IAAU,EACd,OAAO,IAAID,EAAY,UAAW,CAAE,EAAG,UAAW,CAAE,EAAG,UAAW,CAAE,EAAG,UAAW,CAAE,EAAG,UAAW,CAAE,CAAE,EAGvG,IADAG,EAAO,CAAC,EACFE,EAAI,EAAGA,EAAIJ,EAAOI,IACvBF,EAAK,KAAM,UAAWE,CAAE,CAAE,EAG3B,OAAAH,EAAQ,OAAO,OAAQF,EAAW,SAAU,EACrCA,EAAW,MAAOE,EAAOC,CAAK,CACtC,CAEA,IADA,KAAK,MAAQ,CAAC,EACRE,EAAI,EAAGA,EAAIJ,EAAOI,IAAM,CAE7B,GADAD,EAAI,UAAWC,CAAE,EACZ,CAACP,EAASM,CAAE,EAChB,MAAM,IAAI,UAAWP,EAAQ,yHAA0HQ,EAAGD,CAAE,CAAE,EAE/J,KAAK,MAAM,KAAQA,IAAM,OAAW,KAAOA,CAAE,CAC9C,CACA,OAAO,IACR,CAeAb,EAAaS,EAAY,OAAQ,YAAa,EAsB9CR,EAAqBQ,EAAW,UAAW,QAAS,UAAe,CAClE,OAAO,KAAK,MAAM,MACnB,CAAC,EAkCDR,EAAqBQ,EAAW,UAAW,OAAQ,UAAe,CACjE,OAAO,KAAK,MAAM,MAAM,CACzB,CAAC,EAsBDT,EAAaS,EAAW,UAAW,WAAY,UAAoB,CAClE,IAAIM,EACAC,EACAF,EAIJ,IAFAC,EAAO,KAAK,MACZC,EAAM,CAAC,EACDF,EAAI,EAAGA,EAAIC,EAAK,OAAQD,IAC7BE,EAAI,KAAM,OAAQD,EAAMD,CAAE,CAAE,CAAE,EAE/B,MAAO,cAAcE,EAAI,KAAM,GAAI,EAAE,GACtC,CAAC,EA0BDhB,EAAaS,EAAW,UAAW,SAAU,UAAkB,CAC9D,IAAIM,EACAC,EACAH,EACAC,EAOJ,IALAC,EAAO,KAAK,MACZC,EAAM,CACL,KAAQ,aACR,KAAQ,CAAC,CACV,EACMF,EAAI,EAAGA,EAAIC,EAAK,OAAQD,IAC7BD,EAAIE,EAAMD,CAAE,EACZE,EAAI,KAAK,KAAQH,GAAK,OAAOA,EAAE,QAAW,WAAeA,EAAE,OAAO,EAAIA,CAAE,EAEzE,OAAOG,CACR,CAAC,EAKDjB,EAAO,QAAUU,IClPjB,IAAIQ,EAAO,IAKX,OAAO,QAAUA", + "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n/* eslint-disable no-restricted-syntax, no-invalid-this */\n\n'use strict';\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar setReadOnlyAccessor = require( '@stdlib/utils-define-nonenumerable-read-only-accessor' );\nvar isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive;\nvar isNull = require( '@stdlib/assert-is-null' );\nvar isUndefined = require( '@stdlib/assert-is-undefined' );\nvar isSlice = require( '@stdlib/assert-is-slice' );\nvar format = require( '@stdlib/string-format' );\n\n\n// FUNCTIONS //\n\n/**\n* Tests whether an input argument is valid.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether the argument is valid\n*\n* @example\n* var bool = isValid( 3 );\n* // returns true\n*\n* bool = isValid( null );\n* // returns true\n*\n* bool = isValid( void 0 );\n* // returns true\n*\n* bool = isValid( '3' );\n* // returns false\n*/\nfunction isValid( value ) {\n\treturn (\n\t\tisInteger( value ) ||\n\t\tisNull( value ) ||\n\t\tisUndefined( value ) ||\n\t\tisSlice( value )\n\t);\n}\n\n\n// MAIN //\n\n/**\n* Multi-slice constructor.\n*\n* @constructor\n* @param {...(Slice|integer|null)} slice - slice\n* @throws {TypeError} a provided argument must be either a Slice, integer, null, or undefined\n* @returns {MultiSlice} MultiSlice instance\n*\n* @example\n* var Slice = require( '@stdlib/slice-ctor' );\n*\n* var s1 = new Slice( 0, 10, 1 );\n* var s2 = new Slice( 2, 12, 2 );\n*\n* var ms = new MultiSlice( null, s1, s2, 2 );\n* // returns \n*/\nfunction MultiSlice() {\n\tvar nargs;\n\tvar proxy;\n\tvar args;\n\tvar v;\n\tvar i;\n\n\tnargs = arguments.length;\n\tif ( !( this instanceof MultiSlice ) ) {\n\t\tif ( nargs === 1 ) {\n\t\t\treturn new MultiSlice( arguments[ 0 ] );\n\t\t}\n\t\tif ( nargs === 2 ) {\n\t\t\treturn new MultiSlice( arguments[ 0 ], arguments[ 1 ] );\n\t\t}\n\t\tif ( nargs === 3 ) {\n\t\t\treturn new MultiSlice( arguments[ 0 ], arguments[ 1 ], arguments[ 2 ] ); // eslint-disable-line max-len\n\t\t}\n\t\tif ( nargs === 4 ) {\n\t\t\treturn new MultiSlice( arguments[ 0 ], arguments[ 1 ], arguments[ 2 ], arguments[ 3 ] ); // eslint-disable-line max-len\n\t\t}\n\t\tif ( nargs === 5 ) {\n\t\t\treturn new MultiSlice( arguments[ 0 ], arguments[ 1 ], arguments[ 2 ], arguments[ 3 ], arguments[ 4 ] ); // eslint-disable-line max-len\n\t\t}\n\t\targs = [];\n\t\tfor ( i = 0; i < nargs; i++ ) {\n\t\t\targs.push( arguments[ i ] );\n\t\t}\n\t\t// Use a workaround for being unable to combine `.apply` with the `new` operator:\n\t\tproxy = Object.create( MultiSlice.prototype );\n\t\treturn MultiSlice.apply( proxy, args );\n\t}\n\tthis._data = [];\n\tfor ( i = 0; i < nargs; i++ ) {\n\t\tv = arguments[ i ];\n\t\tif ( !isValid( v ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Provided arguments must be either a Slice, integer, null, or undefined. Argument: `%d`. Value: `%s`.', i, String( v ) ) );\n\t\t}\n\t\tthis._data.push( ( v === void 0 ) ? null : v );\n\t}\n\treturn this;\n}\n\n/**\n* Constructor name.\n*\n* @name name\n* @memberof MultiSlice\n* @readonly\n* @type {string}\n* @default 'MultiSlice'\n*\n* @example\n* var str = MultiSlice.name;\n* // returns 'MultiSlice'\n*/\nsetReadOnly( MultiSlice, 'name', 'MultiSlice' );\n\n/**\n* Returns the number of slice dimensions.\n*\n* @name ndims\n* @memberof MultiSlice.prototype\n* @readonly\n* @type {NonNegativeInteger}\n*\n* @example\n* var Slice = require( '@stdlib/slice-ctor' );\n*\n* var s1 = new Slice( 0, 10, 1 );\n* var s2 = new Slice( 2, 12, 2 );\n*\n* var ms = new MultiSlice( null, s1, s2, 2 );\n* // returns \n*\n* var ndims = ms.ndims;\n* // returns 4\n*/\nsetReadOnlyAccessor( MultiSlice.prototype, 'ndims', function get() {\n\treturn this._data.length;\n});\n\n/**\n* Returns multi-slice data.\n*\n* @name data\n* @memberof MultiSlice.prototype\n* @readonly\n* @type {Array}\n*\n* @example\n* var Slice = require( '@stdlib/slice-ctor' );\n*\n* var s1 = new Slice( 0, 10, 1 );\n* var s2 = new Slice( 2, 12, 2 );\n*\n* var ms = new MultiSlice( null, s1, s2, 2 );\n* // returns \n*\n* var data = ms.data;\n* // returns [...]\n*\n* var v = data[ 0 ];\n* // returns null\n*\n* v = data[ 1 ];\n* // returns \n*\n* v = data[ 2 ];\n* // returns \n*\n* v = data[ 3 ];\n* // returns 2\n*/\nsetReadOnlyAccessor( MultiSlice.prototype, 'data', function get() {\n\treturn this._data.slice();\n});\n\n/**\n* Serializes a multi-slice to a string.\n*\n* @name toString\n* @memberof MultiSlice.prototype\n* @type {Function}\n* @returns {string} serialized MultiSlice\n*\n* @example\n* var Slice = require( '@stdlib/slice-ctor' );\n*\n* var s1 = new Slice( 0, 10, 1 );\n* var s2 = new Slice( 2, 12, 2 );\n*\n* var ms = new MultiSlice( null, s1, s2, 2 );\n* // returns \n*\n* var str = ms.toString();\n* // returns 'MultiSlice(null,Slice(0,10,1),Slice(2,12,2),2)'\n*/\nsetReadOnly( MultiSlice.prototype, 'toString', function toString() {\n\tvar data;\n\tvar out;\n\tvar i;\n\n\tdata = this._data;\n\tout = [];\n\tfor ( i = 0; i < data.length; i++ ) {\n\t\tout.push( String( data[ i ] ) );\n\t}\n\treturn 'MultiSlice('+out.join( ',' )+')';\n});\n\n/**\n* Serializes a multi-slice as a JSON object.\n*\n* ## Notes\n*\n* - `JSON.stringify()` implicitly calls this method when stringifying a `MultiSlice` instance.\n*\n* @name toString\n* @memberof MultiSlice.prototype\n* @type {Function}\n* @returns {Object} serialized MultiSlice\n*\n* @example\n* var Slice = require( '@stdlib/slice-ctor' );\n*\n* var s1 = new Slice( 0, 10, 1 );\n* var s2 = new Slice( 2, 12, 2 );\n*\n* var ms = new MultiSlice( null, s1, s2, 2 );\n* // returns \n*\n* var o = ms.toJSON();\n* // returns { 'type': 'MultiSlice', 'data': [ null, { 'type': 'Slice', 'data': [ 0, 10, 1 ] }, { 'type': 'Slice', 'data': [ 2, 12, 2 ] }, 2 ] }\n*/\nsetReadOnly( MultiSlice.prototype, 'toJSON', function toJSON() {\n\tvar data;\n\tvar out;\n\tvar v;\n\tvar i;\n\n\tdata = this._data;\n\tout = {\n\t\t'type': 'MultiSlice',\n\t\t'data': []\n\t};\n\tfor ( i = 0; i < data.length; i++ ) {\n\t\tv = data[ i ];\n\t\tout.data.push( ( v && typeof v.toJSON === 'function' ) ? v.toJSON() : v );\n\t}\n\treturn out;\n});\n\n\n// EXPORTS //\n\nmodule.exports = MultiSlice;\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* Multi-slice constructor.\n*\n* @module @stdlib/slice-multi\n*\n* @example\n* var Slice = require( '@stdlib/slice-ctor' );\n* var MultiSlice = require( '@stdlib/slice-multi' );\n*\n* var s1 = new Slice( 0, 10, 1 );\n* var s2 = new Slice( 2, 12, 2 );\n*\n* var ms = new MultiSlice( null, s1, s2, 2 );\n* // returns \n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], + "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAwBA,IAAIC,EAAc,QAAS,uDAAwD,EAC/EC,EAAsB,QAAS,uDAAwD,EACvFC,EAAY,QAAS,2BAA4B,EAAE,YACnDC,EAAS,QAAS,wBAAyB,EAC3CC,EAAc,QAAS,6BAA8B,EACrDC,EAAU,QAAS,yBAA0B,EAC7CC,EAAS,QAAS,uBAAwB,EAyB9C,SAASC,EAASC,EAAQ,CACzB,OACCN,EAAWM,CAAM,GACjBL,EAAQK,CAAM,GACdJ,EAAaI,CAAM,GACnBH,EAASG,CAAM,CAEjB,CAsBA,SAASC,GAAa,CACrB,IAAIC,EACAC,EACAC,EACAC,EACAC,EAGJ,GADAJ,EAAQ,UAAU,OACb,EAAG,gBAAgBD,GAAe,CACtC,GAAKC,IAAU,EACd,OAAO,IAAID,EAAY,UAAW,CAAE,CAAE,EAEvC,GAAKC,IAAU,EACd,OAAO,IAAID,EAAY,UAAW,CAAE,EAAG,UAAW,CAAE,CAAE,EAEvD,GAAKC,IAAU,EACd,OAAO,IAAID,EAAY,UAAW,CAAE,EAAG,UAAW,CAAE,EAAG,UAAW,CAAE,CAAE,EAEvE,GAAKC,IAAU,EACd,OAAO,IAAID,EAAY,UAAW,CAAE,EAAG,UAAW,CAAE,EAAG,UAAW,CAAE,EAAG,UAAW,CAAE,CAAE,EAEvF,GAAKC,IAAU,EACd,OAAO,IAAID,EAAY,UAAW,CAAE,EAAG,UAAW,CAAE,EAAG,UAAW,CAAE,EAAG,UAAW,CAAE,EAAG,UAAW,CAAE,CAAE,EAGvG,IADAG,EAAO,CAAC,EACFE,EAAI,EAAGA,EAAIJ,EAAOI,IACvBF,EAAK,KAAM,UAAWE,CAAE,CAAE,EAG3B,OAAAH,EAAQ,OAAO,OAAQF,EAAW,SAAU,EACrCA,EAAW,MAAOE,EAAOC,CAAK,CACtC,CAEA,IADA,KAAK,MAAQ,CAAC,EACRE,EAAI,EAAGA,EAAIJ,EAAOI,IAAM,CAE7B,GADAD,EAAI,UAAWC,CAAE,EACZ,CAACP,EAASM,CAAE,EAChB,MAAM,IAAI,UAAWP,EAAQ,yHAA0HQ,EAAG,OAAQD,CAAE,CAAE,CAAE,EAEzK,KAAK,MAAM,KAAQA,IAAM,OAAW,KAAOA,CAAE,CAC9C,CACA,OAAO,IACR,CAeAb,EAAaS,EAAY,OAAQ,YAAa,EAsB9CR,EAAqBQ,EAAW,UAAW,QAAS,UAAe,CAClE,OAAO,KAAK,MAAM,MACnB,CAAC,EAkCDR,EAAqBQ,EAAW,UAAW,OAAQ,UAAe,CACjE,OAAO,KAAK,MAAM,MAAM,CACzB,CAAC,EAsBDT,EAAaS,EAAW,UAAW,WAAY,UAAoB,CAClE,IAAIM,EACAC,EACAF,EAIJ,IAFAC,EAAO,KAAK,MACZC,EAAM,CAAC,EACDF,EAAI,EAAGA,EAAIC,EAAK,OAAQD,IAC7BE,EAAI,KAAM,OAAQD,EAAMD,CAAE,CAAE,CAAE,EAE/B,MAAO,cAAcE,EAAI,KAAM,GAAI,EAAE,GACtC,CAAC,EA0BDhB,EAAaS,EAAW,UAAW,SAAU,UAAkB,CAC9D,IAAIM,EACAC,EACAH,EACAC,EAOJ,IALAC,EAAO,KAAK,MACZC,EAAM,CACL,KAAQ,aACR,KAAQ,CAAC,CACV,EACMF,EAAI,EAAGA,EAAIC,EAAK,OAAQD,IAC7BD,EAAIE,EAAMD,CAAE,EACZE,EAAI,KAAK,KAAQH,GAAK,OAAOA,EAAE,QAAW,WAAeA,EAAE,OAAO,EAAIA,CAAE,EAEzE,OAAOG,CACR,CAAC,EAKDjB,EAAO,QAAUU,IClPjB,IAAIQ,EAAO,IAKX,OAAO,QAAUA", "names": ["require_main", "__commonJSMin", "exports", "module", "setReadOnly", "setReadOnlyAccessor", "isInteger", "isNull", "isUndefined", "isSlice", "format", "isValid", "value", "MultiSlice", "nargs", "proxy", "args", "v", "i", "data", "out", "main"] } diff --git a/lib/main.js b/lib/main.js index 01b6196..2d7512f 100644 --- a/lib/main.js +++ b/lib/main.js @@ -118,7 +118,7 @@ function MultiSlice() { for ( i = 0; i < nargs; i++ ) { v = arguments[ i ]; if ( !isValid( v ) ) { - throw new TypeError( format( 'invalid argument. Provided arguments must be either a Slice, integer, null, or undefined. Argument: `%d`. Value: `%s`.', i, v ) ); + throw new TypeError( format( 'invalid argument. Provided arguments must be either a Slice, integer, null, or undefined. Argument: `%d`. Value: `%s`.', i, String( v ) ) ); } this._data.push( ( v === void 0 ) ? null : v ); } diff --git a/package.json b/package.json index 2adf29e..e400896 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "dependencies": { "@stdlib/assert-is-integer": "^0.1.0", "@stdlib/assert-is-null": "^0.1.0", - "@stdlib/assert-is-slice": "github:stdlib-js/assert-is-slice#main", + "@stdlib/assert-is-slice": "^0.1.0", "@stdlib/assert-is-undefined": "^0.1.0", "@stdlib/string-format": "^0.1.0", "@stdlib/types": "^0.1.0", @@ -52,7 +52,7 @@ "@stdlib/assert-instance-of": "^0.1.0", "@stdlib/assert-is-array": "^0.1.0", "@stdlib/assert-is-function": "^0.1.0", - "@stdlib/assert-is-nonnegative-integer": "^0.0.7", + "@stdlib/assert-is-nonnegative-integer": "^0.1.0", "@stdlib/assert-is-plain-object": "^0.1.0", "@stdlib/assert-is-string": "^0.1.0", "@stdlib/bench": "^0.1.0", diff --git a/test/dist/test.js b/test/dist/test.js new file mode 100644 index 0000000..7859cd3 --- /dev/null +++ b/test/dist/test.js @@ -0,0 +1,1041 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2023 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF 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 instanceOf = require( '@stdlib/assert-instance-of' ); +var hasOwnProp = require( '@stdlib/assert-has-own-property' ); +var hasProp = require( '@stdlib/assert-has-property' ); +var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive; +var isArray = require( '@stdlib/assert-is-array' ); +var isSlice = require( '@stdlib/assert-is-slice' ); +var isFunction = require( '@stdlib/assert-is-function' ); +var S = require( '@stdlib/slice-ctor' ); +var MultiSlice = require( './../../dist' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof MultiSlice, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function is a MultiSlice constructor', function test( t ) { + var slice; + var nargs; + var args; + var arr; + var s; + var i; + + slice = new S( 2, 10, 1 ); + + args = [ + [], + [ 10 ], + [ null ], + [ void 0 ], + [ slice ], + [ 0, 10 ], + [ 0, null ], + [ null, 10 ], + [ slice, slice ], + [ 0, 10, 10 ], + [ 0, slice, void 0 ], + [ 0, slice, slice, null ], + [ null, slice, void 0, slice, 10 ] + ]; + for ( i = 0; i < args.length; i++ ) { + arr = args[ i ]; + nargs = arr.length; + if ( nargs === 0 ) { + s = new MultiSlice(); + } else if ( nargs === 1 ) { + s = new MultiSlice( arr[ 0 ] ); + } else if ( nargs === 2 ) { + s = new MultiSlice( arr[ 0 ], arr[ 1 ] ); + } else if ( nargs === 3 ) { + s = new MultiSlice( arr[ 0 ], arr[ 1 ], arr[ 2 ] ); + } else if ( nargs === 4 ) { + s = new MultiSlice( arr[ 0 ], arr[ 1 ], arr[ 2 ], arr[ 3 ] ); + } else if ( nargs === 5 ) { + s = new MultiSlice( arr[ 0 ], arr[ 1 ], arr[ 2 ], arr[ 3 ], arr[ 4 ] ); // eslint-disable-line max-len + } else if ( nargs === 6 ) { + s = new MultiSlice( arr[ 0 ], arr[ 1 ], arr[ 2 ], arr[ 3 ], arr[ 4 ], arr[ 5 ] ); // eslint-disable-line max-len + } + t.strictEqual( instanceOf( s, MultiSlice ), true, 'returns an instance for arguments ' + i ); + } + t.end(); +}); + +tape( 'the function does not require the `new` keyword', function test( t ) { + var mslice; + var slice; + var args; + var s; + var i; + + mslice = MultiSlice; + slice = new S( 2, 10, 1 ); + + args = [ + [], + [ 10 ], + [ null ], + [ void 0 ], + [ slice ], + [ 0, 10 ], + [ 0, null ], + [ null, 10 ], + [ s, s ], + [ 0, 10, 10 ], + [ 0, s, void 0 ], + [ 0, s, s, null ], + [ null, s, void 0, s, 10 ] + ]; + for ( i = 0; i < args.length; i++ ) { + s = mslice.apply( null, args[ i ] ); + t.strictEqual( instanceOf( s, MultiSlice ), true, 'returns an instance for arguments ' + i ); + } + t.end(); +}); + +tape( 'attached to the constructor is a `name` property', function test( t ) { + t.strictEqual( MultiSlice.name, 'MultiSlice', 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid first argument (nargs=1,new)', function test( t ) { + var values; + var i; + + values = [ + '3', + 3.14, + NaN, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badvalue() { + new MultiSlice( value ); // eslint-disable-line no-new + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid first argument (nargs=2,new)', function test( t ) { + var values; + var i; + + values = [ + '3', + 3.14, + NaN, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badvalue() { + new MultiSlice( value, 2 ); // eslint-disable-line no-new + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid first argument (nargs=3,new)', function test( t ) { + var values; + var i; + + values = [ + '3', + 3.14, + NaN, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badvalue() { + new MultiSlice( value, 2, 3 ); // eslint-disable-line no-new + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid first argument (nargs=4,new)', function test( t ) { + var values; + var i; + + values = [ + '3', + 3.14, + NaN, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badvalue() { + new MultiSlice( value, 2, 3, 4 ); // eslint-disable-line no-new + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid first argument (nargs=5,new)', function test( t ) { + var values; + var i; + + values = [ + '3', + 3.14, + NaN, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badvalue() { + new MultiSlice( value, 2, 3, 4, 5 ); // eslint-disable-line no-new + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid first argument (nargs=2,no new)', function test( t ) { + var values; + var mslice; + var i; + + mslice = MultiSlice; + + values = [ + '3', + 3.14, + NaN, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badvalue() { + mslice( value, 2 ); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid first argument (nargs=3,no new)', function test( t ) { + var values; + var mslice; + var i; + + mslice = MultiSlice; + + values = [ + '3', + 3.14, + NaN, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badvalue() { + mslice( value, 2, 3 ); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid first argument (nargs=4,no new)', function test( t ) { + var values; + var mslice; + var i; + + mslice = MultiSlice; + + values = [ + '3', + 3.14, + NaN, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badvalue() { + mslice( value, 2, 3, 4 ); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid first argument (nargs=5,no new)', function test( t ) { + var values; + var mslice; + var i; + + mslice = MultiSlice; + + values = [ + '3', + 3.14, + NaN, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badvalue() { + mslice( value, 2, 3, 4, 5 ); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid second argument (nargs=2,new)', function test( t ) { + var values; + var i; + + values = [ + '3', + 3.14, + NaN, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badvalue() { + new MultiSlice( 1, value ); // eslint-disable-line no-new + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid second argument (nargs=3,new)', function test( t ) { + var values; + var i; + + values = [ + '3', + 3.14, + NaN, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badvalue() { + new MultiSlice( 1, value, 3 ); // eslint-disable-line no-new + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid second argument (nargs=4,new)', function test( t ) { + var values; + var i; + + values = [ + '3', + 3.14, + NaN, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badvalue() { + new MultiSlice( 1, value, 3, 4 ); // eslint-disable-line no-new + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid second argument (nargs=5,new)', function test( t ) { + var values; + var i; + + values = [ + '3', + 3.14, + NaN, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badvalue() { + new MultiSlice( 1, value, 3, 4, 5 ); // eslint-disable-line no-new + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid second argument (nargs=2,no new)', function test( t ) { + var values; + var mslice; + var i; + + mslice = MultiSlice; + + values = [ + '3', + 3.14, + NaN, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badvalue() { + mslice( 1, value ); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid second argument (nargs=3,no new)', function test( t ) { + var values; + var mslice; + var i; + + mslice = MultiSlice; + + values = [ + '3', + 3.14, + NaN, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badvalue() { + mslice( 1, value, 3 ); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid second argument (nargs=4,no new)', function test( t ) { + var values; + var mslice; + var i; + + mslice = MultiSlice; + + values = [ + '3', + 3.14, + NaN, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badvalue() { + mslice( 1, value, 3, 4 ); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid second argument (nargs=5,no new)', function test( t ) { + var values; + var mslice; + var i; + + mslice = MultiSlice; + + values = [ + '3', + 3.14, + NaN, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badvalue() { + mslice( 1, value, 3, 4, 5 ); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid third argument (nargs=3,new)', function test( t ) { + var values; + var i; + + values = [ + '3', + 3.14, + NaN, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badvalue() { + new MultiSlice( 1, 2, value ); // eslint-disable-line no-new + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid third argument (nargs=4,new)', function test( t ) { + var values; + var i; + + values = [ + '3', + 3.14, + NaN, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badvalue() { + new MultiSlice( 1, 2, value, 4 ); // eslint-disable-line no-new + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid third argument (nargs=5,new)', function test( t ) { + var values; + var i; + + values = [ + '3', + 3.14, + NaN, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badvalue() { + new MultiSlice( 1, 2, value, 4, 5 ); // eslint-disable-line no-new + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid third argument (nargs=3,no new)', function test( t ) { + var values; + var mslice; + var i; + + mslice = MultiSlice; + + values = [ + '3', + 3.14, + NaN, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badvalue() { + mslice( 1, 2, value ); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid third argument (nargs=4,no new)', function test( t ) { + var values; + var mslice; + var i; + + mslice = MultiSlice; + + values = [ + '3', + 3.14, + NaN, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badvalue() { + mslice( 1, 2, value, 4 ); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid third argument (nargs=5,no new)', function test( t ) { + var values; + var mslice; + var i; + + mslice = MultiSlice; + + values = [ + '3', + 3.14, + NaN, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badvalue() { + mslice( 1, 2, value, 4, 5 ); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid fourth argument (nargs=4,new)', function test( t ) { + var values; + var i; + + values = [ + '3', + 3.14, + NaN, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badvalue() { + new MultiSlice( 1, 2, 3, value ); // eslint-disable-line no-new + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid fourth argument (nargs=5,new)', function test( t ) { + var values; + var i; + + values = [ + '3', + 3.14, + NaN, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badvalue() { + new MultiSlice( 1, 2, 3, value, 5 ); // eslint-disable-line no-new + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid fourth argument (nargs=4,no new)', function test( t ) { + var values; + var mslice; + var i; + + mslice = MultiSlice; + + values = [ + '3', + 3.14, + NaN, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badvalue() { + mslice( 1, 2, 3, value ); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid fourth argument (nargs=5,no new)', function test( t ) { + var values; + var mslice; + var i; + + mslice = MultiSlice; + + values = [ + '3', + 3.14, + NaN, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badvalue() { + mslice( 1, 2, 3, value, 5 ); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid fifth argument (nargs=5,new)', function test( t ) { + var values; + var i; + + values = [ + '3', + 3.14, + NaN, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badvalue() { + new MultiSlice( 1, 2, 3, 4, value ); // eslint-disable-line no-new + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid fifth argument (nargs=5,no new)', function test( t ) { + var values; + var mslice; + var i; + + mslice = MultiSlice; + + values = [ + '3', + 3.14, + NaN, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badvalue() { + mslice( 1, 2, 3, 4, value ); + }; + } +}); + +tape( 'a multi-slice has an `ndims` property specifying the number of slice dimensions', function test( t ) { + var s; + + s = new MultiSlice(); + t.strictEqual( hasOwnProp( s, 'ndims' ), false, 'does not have own property' ); + t.strictEqual( hasProp( s, 'ndims' ), true, 'has property' ); + t.strictEqual( isNonNegativeInteger( s.ndims ), true, 'is a nonnegative integer' ); + t.strictEqual( s.ndims, 0, 'returns expected value' ); + + s = new MultiSlice( 0 ); + t.strictEqual( hasOwnProp( s, 'ndims' ), false, 'does not have own property' ); + t.strictEqual( hasProp( s, 'ndims' ), true, 'has property' ); + t.strictEqual( isNonNegativeInteger( s.ndims ), true, 'is a nonnegative integer' ); + t.strictEqual( s.ndims, 1, 'returns expected value' ); + + s = new MultiSlice( 1, 1 ); + t.strictEqual( hasOwnProp( s, 'ndims' ), false, 'does not have own property' ); + t.strictEqual( hasProp( s, 'ndims' ), true, 'has property' ); + t.strictEqual( isNonNegativeInteger( s.ndims ), true, 'is a nonnegative integer' ); + t.strictEqual( s.ndims, 2, 'returns expected value' ); + + s = new MultiSlice( 2, 2, 2 ); + t.strictEqual( hasOwnProp( s, 'ndims' ), false, 'does not have own property' ); + t.strictEqual( hasProp( s, 'ndims' ), true, 'has property' ); + t.strictEqual( isNonNegativeInteger( s.ndims ), true, 'is a nonnegative integer' ); + t.strictEqual( s.ndims, 3, 'returns expected value' ); + + t.end(); +}); + +tape( 'a multi-slice has a `data` property for retrieving slice data', function test( t ) { + var slice; + var data; + var s; + + slice = new S( 2, 10, 1 ); + + s = new MultiSlice(); + t.strictEqual( hasOwnProp( s, 'data' ), false, 'does not have own property' ); + t.strictEqual( hasProp( s, 'data' ), true, 'has property' ); + t.strictEqual( isArray( s.data ), true, 'is an array' ); + t.deepEqual( s.data, [], 'returns expected value' ); + + s = new MultiSlice( 2, slice, null ); + t.strictEqual( hasOwnProp( s, 'data' ), false, 'does not have own property' ); + t.strictEqual( hasProp( s, 'data' ), true, 'has property' ); + t.strictEqual( isArray( s.data ), true, 'is an array' ); + + data = s.data; + t.strictEqual( data[ 0 ], 2, 'returns expected value' ); + t.strictEqual( isSlice( data[ 1 ] ), true, 'returns expected value' ); + t.strictEqual( data[ 1 ].start, slice.start, 'returns expected value' ); + t.strictEqual( data[ 1 ].stop, slice.stop, 'returns expected value' ); + t.strictEqual( data[ 1 ].step, slice.step, 'returns expected value' ); + t.strictEqual( data[ 2 ], null, 'returns expected value' ); + + t.end(); +}); + +tape( 'a multi-slice has a custom `toString()` method', function test( t ) { + var slice; + var s; + + slice = new S( 2, 10, 1 ); + + s = new MultiSlice(); + t.strictEqual( hasOwnProp( s, 'toString' ), false, 'does not have own property' ); + t.strictEqual( hasProp( s, 'toString' ), true, 'has property' ); + t.strictEqual( isFunction( s.toString ), true, 'has method' ); + t.strictEqual( s.toString(), 'MultiSlice()', 'returns expected value' ); + + s = new MultiSlice( 2, slice, null ); + t.strictEqual( hasOwnProp( s, 'toString' ), false, 'does not have own property' ); + t.strictEqual( hasProp( s, 'toString' ), true, 'has property' ); + t.strictEqual( isFunction( s.toString ), true, 'has method' ); + t.strictEqual( s.toString(), 'MultiSlice(2,Slice(2,10,1),null)', 'returns expected value' ); + + t.end(); +}); + +tape( 'a multi-slice has a custom `toJSON()` method', function test( t ) { + var expected; + var slice; + var s; + + slice = new S( 2, 10, 1 ); + + s = new MultiSlice(); + t.strictEqual( hasOwnProp( s, 'toJSON' ), false, 'does not have own property' ); + t.strictEqual( hasProp( s, 'toJSON' ), true, 'has property' ); + t.strictEqual( isFunction( s.toJSON ), true, 'has method' ); + + expected = { + 'type': 'MultiSlice', + 'data': [] + }; + t.deepEqual( s.toJSON(), expected, 'returns expected value' ); + + s = new MultiSlice( 2, slice, null ); + t.strictEqual( hasOwnProp( s, 'toJSON' ), false, 'does not have own property' ); + t.strictEqual( hasProp( s, 'toJSON' ), true, 'has property' ); + t.strictEqual( isFunction( s.toJSON ), true, 'has method' ); + + expected = { + 'type': 'MultiSlice', + 'data': [ + 2, + { + 'type': 'Slice', + 'data': [ 2, 10, 1 ] + }, + null + ] + }; + t.deepEqual( s.toJSON(), expected, 'returns expected value' ); + + t.end(); +});