Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bevry-archive/argsbytype
Deprecated. Use https://github.com/bevry/argument
https://github.com/bevry-archive/argsbytype
argument-parser client-side nodejs
Last synced: about 9 hours ago
JSON representation
Deprecated. Use https://github.com/bevry/argument
- Host: GitHub
- URL: https://github.com/bevry-archive/argsbytype
- Owner: bevry-archive
- License: other
- Created: 2014-07-03T16:31:08.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T10:29:33.000Z (almost 2 years ago)
- Last Synced: 2024-04-08T15:41:44.558Z (7 months ago)
- Topics: argument-parser, client-side, nodejs
- Language: JavaScript
- Homepage:
- Size: 1.11 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- Changelog: HISTORY.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
Awesome Lists containing this project
README
Arguments By Type
Provide some arguments, get back a hash object of the arguments indexed by their type. Very useful for agnostic argument orders.
## 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
- Install:
npm install --save argsbytype
- Import:
import * as pkg from ('argsbytype')
- Require:
const pkg = require('argsbytype')
``` html
import * as pkg from '//dev.jspm.io/[email protected]'
```
Editions
This package is published with the following editions:
-
argsbytype
aliasesargsbytype/source/index.js
-
argsbytype/source/index.js
is ESNext source code for Node.js 10 || 12 || 14 || 15 with Require for modules -
argsbytype/edition-browsers/index.js
is ESNext compiled for web browsers with Require for modules
History
Discover the release history by heading on over to the HISTORY.md
file.
Contribute
Discover how you can contribute by heading on over to the CONTRIBUTING.md
file.
Backers
Maintainers
These amazing people are maintaining this project:
Sponsors
No sponsors yet! Will you be the first?
Contributors
These amazing people have contributed code to this project:
Discover how you can contribute by heading on over to the CONTRIBUTING.md
file.
License
Unless stated otherwise all works are:
- Copyright © 2014+ Bevry Pty Ltd
and licensed under: