# boptions

> Powerful options parser for functions

Latest version **0.6.0** (published 2019-09-25) · ISC license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.6.0 |
| Published | 2019-09-25 |
| First published | 2016-03-26 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 16.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Samm Cooper |
| Maintainers | koopero |
| Keywords | javascript, function, options, parser |

## Links

- npm: https://www.npmjs.com/package/boptions
- Repository: https://github.com/koopero/boptions
- Homepage: https://github.com/koopero/boptions#readme
- Issues: https://github.com/koopero/boptions/issues
- npm.io page: https://npm.io/package/boptions

## Dependencies (2)

- [lodash](https://npm.io/package/lodash.md) ^4.17.4
- [metahash](https://npm.io/package/metahash.md) ^1.0.0

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 0.6.0 (latest) — 2019-09-25
- 0.5.0 — 2017-11-11
- 0.4.3 — 2016-07-17
- 0.4.2 — 2016-06-21
- 0.4.1 — 2016-06-11
- 0.3.0 — 2016-06-03
- 0.2.1 — 2016-03-26
- 0.2.0 — 2016-03-26

## README

# Status

This module is under development. Check back later.

# Example

```js
MyFunc.options = boptions( {
  '#inline': [ 'hostname', 'port' ],
  'hostname': '127.0.0.1',
  'port': {
    'type': 'int',
    'min': 1024,
    'max': 65535,
    'value': 31337
  },
  'encoding': 'ascii'
})

function MyFunc () {
  const options = MyFunc.options( arguments )
  // options now contains safe, validated options!
}

deepEqual( )
  MyFunc.options(),
  { hostname: '127.0.0.1', port: 31337, encoding: 'ascii' }
)

deepEqual(
  MyFunc.options( 'example.com', 2222 ),
  { hostname: 'example.com', port: 2222, encoding: 'ascii' }
)

deepEqual(
  MyFunc.options( { hostname: '10.10.10.10' }, { encoding: 'utf8' } ),
  { hostname: '10.10.10.10', port: 2222, encoding: 'utf8' }
)

MyFunc.options( 0 )
// throws ArgumentError -> 'Option port must be in range 1024-65535'

```
# Performance

`boptions` is designed to be flexible, easy to use and thorough. Unfortunately,
this comes at the cost of speed. I would *NOT* recommend using it for functions
that are being called frequently.

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