# argsbytype

> Provide some arguments, get back a hash object of the arguments indexed by their type. Very useful for agnostic argument orders.

Latest version **3.21.0** (published 2020-10-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install argsbytype
pnpm add argsbytype
yarn add argsbytype
bun add argsbytype
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.21.0 |
| Published | 2020-10-28 |
| First published | 2014-07-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=10 |
| Dependencies | 1 |
| Unpacked size | 24 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | 2014+ Bevry Pty Ltd |
| Maintainers | balupton, bevryme |
| Keywords | args, arguments, browser, esnext, node, utility |

## Links

- npm: https://www.npmjs.com/package/argsbytype
- Repository: https://github.com/bevry/argsbytype
- Issues: https://github.com/bevry/argsbytype/issues
- Funding: https://bevry.me/fund
- npm.io page: https://npm.io/package/argsbytype

## Dependencies (1)

- [typechecker](https://npm.io/package/typechecker.md) ^7.16.0

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 3.21.0 (latest) — 2020-10-28
- 3.21.0-next.1603919847.a0f6cd1e352dfaf4c27a775acb8628aefc833e7e (next) — 2020-10-28
- 3.20.0-next.1603631168.88c431993350515206163f32380b47eacd08e29b — 2020-10-25
- 3.20.0-next.1603626268.621341e58f3bfa2da220a8b884a7bf42a2362b9d — 2020-10-25
- 3.20.0-next.1603017935.e734818dca0cbfb892efc5dbd9d0397aff7e273e — 2020-10-18
- 3.20.0-next.1602409706.1ceef50bc56968595b63e6d468809500b9f0ca88 — 2020-10-11
- 3.20.0-next.1601215694.c37eda15895d939d74923fdba09c30b80aa1ac0d — 2020-09-27
- 3.20.0-next.1601211160.38538c6721067f37d0a96f9d7240867d193a8102 — 2020-09-27
- 3.20.0-next.1600602259.4bc1996a563c9f77abd9524e504ab6d04b621bde — 2020-09-20
- 3.20.0-next.1599994821.20ceda402c849635fe751d0ee6b4e2feabcde9f3 — 2020-09-13
- 3.20.0-next.1599398202.cb65e2f0a420808023a87360d895ee1fa65b8e59 — 2020-09-06
- 3.20.0 — 2020-09-04
- 3.20.0-next.1599204692.948165be174f90aef4b026069b19cfe0aafe61df — 2020-09-04
- 3.20.0-next.1599204616.232033853b2ea820d3e213206448d8f76f8d20ea — 2020-09-04
- 3.19.0 — 2020-08-17
- … 60 more at https://npm.io/package/argsbytype/versions

## README

<!-- TITLE/ -->

<h1>Arguments By Type</h1>

<!-- /TITLE -->

<!-- BADGES/ -->

<span class="badge-travisci"><a href="http://travis-ci.com/bevry/argsbytype" title="Check this project's build status on TravisCI"><img src="https://img.shields.io/travis/com/bevry/argsbytype/master.svg" alt="Travis CI Build Status" /></a></span>
<span class="badge-npmversion"><a href="https://npmjs.org/package/argsbytype" title="View this project on NPM"><img src="https://img.shields.io/npm/v/argsbytype.svg" alt="NPM version" /></a></span>
<span class="badge-npmdownloads"><a href="https://npmjs.org/package/argsbytype" title="View this project on NPM"><img src="https://img.shields.io/npm/dm/argsbytype.svg" alt="NPM downloads" /></a></span>
<span class="badge-daviddm"><a href="https://david-dm.org/bevry/argsbytype" title="View the status of this project's dependencies on DavidDM"><img src="https://img.shields.io/david/bevry/argsbytype.svg" alt="Dependency Status" /></a></span>
<span class="badge-daviddmdev"><a href="https://david-dm.org/bevry/argsbytype#info=devDependencies" title="View the status of this project's development dependencies on DavidDM"><img src="https://img.shields.io/david/dev/bevry/argsbytype.svg" alt="Dev Dependency Status" /></a></span>
<br class="badge-separator" />
<span class="badge-githubsponsors"><a href="https://github.com/sponsors/balupton" title="Donate to this project using GitHub Sponsors"><img src="https://img.shields.io/badge/github-donate-yellow.svg" alt="GitHub Sponsors donate button" /></a></span>
<span class="badge-patreon"><a href="https://patreon.com/bevry" title="Donate to this project using Patreon"><img src="https://img.shields.io/badge/patreon-donate-yellow.svg" alt="Patreon donate button" /></a></span>
<span class="badge-flattr"><a href="https://flattr.com/profile/balupton" title="Donate to this project using Flattr"><img src="https://img.shields.io/badge/flattr-donate-yellow.svg" alt="Flattr donate button" /></a></span>
<span class="badge-liberapay"><a href="https://liberapay.com/bevry" title="Donate to this project using Liberapay"><img src="https://img.shields.io/badge/liberapay-donate-yellow.svg" alt="Liberapay donate button" /></a></span>
<span class="badge-buymeacoffee"><a href="https://buymeacoffee.com/balupton" title="Donate to this project using Buy Me A Coffee"><img src="https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg" alt="Buy Me A Coffee donate button" /></a></span>
<span class="badge-opencollective"><a href="https://opencollective.com/bevry" title="Donate to this project using Open Collective"><img src="https://img.shields.io/badge/open%20collective-donate-yellow.svg" alt="Open Collective donate button" /></a></span>
<span class="badge-crypto"><a href="https://bevry.me/crypto" title="Donate to this project using Cryptocurrency"><img src="https://img.shields.io/badge/crypto-donate-yellow.svg" alt="crypto donate button" /></a></span>
<span class="badge-paypal"><a href="https://bevry.me/paypal" title="Donate to this project using Paypal"><img src="https://img.shields.io/badge/paypal-donate-yellow.svg" alt="PayPal donate button" /></a></span>
<span class="badge-wishlist"><a href="https://bevry.me/wishlist" title="Buy an item on our wishlist for us"><img src="https://img.shields.io/badge/wishlist-donate-yellow.svg" alt="Wishlist browse button" /></a></span>

<!-- /BADGES -->

<!-- DESCRIPTION/ -->

Provide some arguments, get back a hash object of the arguments indexed by their type. Very useful for agnostic argument orders.

<!-- /DESCRIPTION -->

## Usage

Let's say your coding a function, and you want to accept arguments in any order. Traditionally this would look like:

> https://github.com/bevry/argsbytype/blob/master/example/01.js

But what happens when you:

-   Start having arguments that are regular expressions or dates which `typeof` is still `object` instead of `regexp` or `date`
-   Or, when you start having multiple arguments of the same type, that you would like to accept (e.g. the first string should be the `name` property, the second string should be the `keyword` property)

At that point in time, it becomes too much trouble to bother with. Fortunately, `argsbytype` is to the rescue! Now you can do:

> https://github.com/bevry/argsbytype/blob/master/example/02.js

Yay! Big win for agnostic argument order! But when would you actually want this? Well, it turns out that in CoffeeScript options come first, in JavaScript, options usually come last. By using this, we can support both conventions, for example:

> https://github.com/bevry/argsbytype/blob/master/example/03.js

<!-- INSTALL/ -->

<h2>Install</h2>

<a href="https://npmjs.com" title="npm is a package manager for javascript"><h3>npm</h3></a>

<ul>
<li>Install: <code>npm install --save argsbytype</code></li>
<li>Import: <code>import * as pkg from ('argsbytype')</code></li>
<li>Require: <code>const pkg = require('argsbytype')</code></li>
</ul>

<a href="https://jspm.io" title="Native ES Modules CDN"><h3>jspm</h3></a>

```html
<script type="module">
    import * as pkg from '//dev.jspm.io/argsbytype@3.21.0'
</script>
```

<h3><a href="https://editions.bevry.me" title="Editions are the best way to produce and consume packages you care about.">Editions</a></h3>

<p>This package is published with the following editions:</p>

<ul><li><code>argsbytype</code> aliases <code>argsbytype/source/index.js</code></li>
<li><code>argsbytype/source/index.js</code> is <a href="https://en.wikipedia.org/wiki/ECMAScript#ES.Next" title="ECMAScript Next">ESNext</a> source code for <a href="https://nodejs.org" title="Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine">Node.js</a> 10 || 12 || 14 || 15 with <a href="https://nodejs.org/dist/latest-v5.x/docs/api/modules.html" title="Node/CJS Modules">Require</a> for modules</li>
<li><code>argsbytype/edition-browsers/index.js</code> is <a href="https://en.wikipedia.org/wiki/ECMAScript#ES.Next" title="ECMAScript Next">ESNext</a> compiled for web browsers with <a href="https://nodejs.org/dist/latest-v5.x/docs/api/modules.html" title="Node/CJS Modules">Require</a> for modules</li></ul>

<!-- /INSTALL -->

<!-- HISTORY/ -->

<h2>History</h2>

<a href="https://github.com/bevry/argsbytype/blob/master/HISTORY.md#files">Discover the release history by heading on over to the <code>HISTORY.md</code> file.</a>

<!-- /HISTORY -->

<!-- CONTRIBUTE/ -->

<h2>Contribute</h2>

<a href="https://github.com/bevry/argsbytype/blob/master/CONTRIBUTING.md#files">Discover how you can contribute by heading on over to the <code>CONTRIBUTING.md</code> file.</a>

<!-- /CONTRIBUTE -->

<!-- BACKERS/ -->

<h2>Backers</h2>

<h3>Maintainers</h3>

These amazing people are maintaining this project:

<ul><li><a href="https://github.com/balupton">Benjamin Lupton</a> — <a href="https://github.com/bevry/argsbytype/commits?author=balupton" title="View the GitHub contributions of Benjamin Lupton on repository bevry/argsbytype">view contributions</a></li></ul>

<h3>Sponsors</h3>

No sponsors yet! Will you be the first?

<span class="badge-githubsponsors"><a href="https://github.com/sponsors/balupton" title="Donate to this project using GitHub Sponsors"><img src="https://img.shields.io/badge/github-donate-yellow.svg" alt="GitHub Sponsors donate button" /></a></span>
<span class="badge-patreon"><a href="https://patreon.com/bevry" title="Donate to this project using Patreon"><img src="https://img.shields.io/badge/patreon-donate-yellow.svg" alt="Patreon donate button" /></a></span>
<span class="badge-flattr"><a href="https://flattr.com/profile/balupton" title="Donate to this project using Flattr"><img src="https://img.shields.io/badge/flattr-donate-yellow.svg" alt="Flattr donate button" /></a></span>
<span class="badge-liberapay"><a href="https://liberapay.com/bevry" title="Donate to this project using Liberapay"><img src="https://img.shields.io/badge/liberapay-donate-yellow.svg" alt="Liberapay donate button" /></a></span>
<span class="badge-buymeacoffee"><a href="https://buymeacoffee.com/balupton" title="Donate to this project using Buy Me A Coffee"><img src="https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg" alt="Buy Me A Coffee donate button" /></a></span>
<span class="badge-opencollective"><a href="https://opencollective.com/bevry" title="Donate to this project using Open Collective"><img src="https://img.shields.io/badge/open%20collective-donate-yellow.svg" alt="Open Collective donate button" /></a></span>
<span class="badge-crypto"><a href="https://bevry.me/crypto" title="Donate to this project using Cryptocurrency"><img src="https://img.shields.io/badge/crypto-donate-yellow.svg" alt="crypto donate button" /></a></span>
<span class="badge-paypal"><a href="https://bevry.me/paypal" title="Donate to this project using Paypal"><img src="https://img.shields.io/badge/paypal-donate-yellow.svg" alt="PayPal donate button" /></a></span>
<span class="badge-wishlist"><a href="https://bevry.me/wishlist" title="Buy an item on our wishlist for us"><img src="https://img.shields.io/badge/wishlist-donate-yellow.svg" alt="Wishlist browse button" /></a></span>

<h3>Contributors</h3>

These amazing people have contributed code to this project:

<ul><li><a href="https://github.com/balupton">Benjamin Lupton</a> — <a href="https://github.com/bevry/argsbytype/commits?author=balupton" title="View the GitHub contributions of Benjamin Lupton on repository bevry/argsbytype">view contributions</a></li></ul>

<a href="https://github.com/bevry/argsbytype/blob/master/CONTRIBUTING.md#files">Discover how you can contribute by heading on over to the <code>CONTRIBUTING.md</code> file.</a>

<!-- /BACKERS -->

<!-- LICENSE/ -->

<h2>License</h2>

Unless stated otherwise all works are:

<ul><li>Copyright &copy; 2014+ <a href="http://bevry.me">Bevry Pty Ltd</a></li></ul>

and licensed under:

<ul><li><a href="http://spdx.org/licenses/MIT.html">MIT License</a></li></ul>

<!-- /LICENSE -->

---
_Source: https://npm.io/package/argsbytype · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
