# opt-stack

> Get options from a stack of sources.

Latest version **1.0.8** (published 2016-04-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install opt-stack
pnpm add opt-stack
yarn add opt-stack
bun add opt-stack
```

## 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 | 1.0.8 |
| Published | 2016-04-21 |
| First published | 2016-04-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 18 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | joshrtay, weo-edu |

## Links

- npm: https://www.npmjs.com/package/opt-stack
- Repository: https://github.com/joshrtay/opt-stack
- Homepage: https://github.com/joshrtay/opt-stack#readme
- Issues: https://github.com/joshrtay/opt-stack/issues
- npm.io page: https://npm.io/package/opt-stack

## Dependencies (18)

- [@f/map](https://npm.io/package/@f/map.md) ^1.5.3
- [@f/omit](https://npm.io/package/@f/omit.md) ^2.2.3
- [minimist](https://npm.io/package/minimist.md) ^1.2.0
- [@f/extend](https://npm.io/package/@f/extend.md) ^1.0.0
- [@f/switch](https://npm.io/package/@f/switch.md) ^1.0.0
- [camel-case](https://npm.io/package/camel-case.md) ^1.2.2
- [@f/identity](https://npm.io/package/@f/identity.md) ^1.1.1
- [@f/is-array](https://npm.io/package/@f/is-array.md) ^1.1.1
- [@f/is-number](https://npm.io/package/@f/is-number.md) ^1.1.1
- [@f/is-object](https://npm.io/package/@f/is-object.md) ^1.1.4
- [@f/is-string](https://npm.io/package/@f/is-string.md) ^1.1.1
- [@f/is-boolean](https://npm.io/package/@f/is-boolean.md) ^1.0.0
- [@f/is-function](https://npm.io/package/@f/is-function.md) ^1.1.1
- [@f/is-undefined](https://npm.io/package/@f/is-undefined.md) ^1.1.1
- [@f/string-is-number](https://npm.io/package/@f/string-is-number.md) ^1.0.0
- [@f/string-to-number](https://npm.io/package/@f/string-to-number.md) ^1.0.0
- [@f/string-is-boolean](https://npm.io/package/@f/string-is-boolean.md) ^1.0.0
- [@f/string-to-boolean](https://npm.io/package/@f/string-to-boolean.md) ^1.0.1

## Recent versions

- 1.0.8 (latest) — 2016-04-21
- 1.0.7 — 2016-04-09
- 1.0.6 — 2016-04-09
- 1.0.5 — 2016-04-08
- 1.0.4 — 2016-04-08
- 1.0.3 — 2016-04-08
- 1.0.2 — 2016-04-08
- 1.0.1 — 2016-04-08
- 1.0.0 — 2016-04-07

## README

# opt-stack

[![Build status][travis-image]][travis-url]
[![Git tag][git-image]][git-url]
[![NPM version][npm-image]][npm-url]
[![Code style][standard-image]][standard-url]

Get options from a stack of sources ... cli, package, defaults.

## Features

* Pull options from `name` field in package.json
* Pull options from cli
* Coerce strings into numbers and booleans
* Supports default values
* Specify required options
* Optionally create your own option stack with environment support

## Installation

    $ npm install opt-stack

## Usage

```js
var optStack = require('opt-stack')

// node cli --foo=cli
optStack('woot', {foo: 'bar'}) // => {foo: 'cli'}
optStack('woot', {qux: String}) // => throw new Error('qux required')
optStack('woot', {foo: 1}) // => throw new TypeError('got string for "foo", expecting number')
```

## API

### optStack(name, schema)

- `name` - name is use for env prefix and packageJson field
- `schema` - psuedo schema, if val its a default value, if type its a required field

**Returns:** options

## License

MIT

[travis-image]: https://img.shields.io/travis/joshrtay/opt-stack.svg?style=flat-square
[travis-url]: https://travis-ci.org/joshrtay/opt-stack
[git-image]: https://img.shields.io/github/tag/joshrtay/opt-stack.svg?style=flat-square
[git-url]: https://github.com/joshrtay/opt-stack
[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square
[standard-url]: https://github.com/feross/standard
[npm-image]: https://img.shields.io/npm/v/opt-stack.svg?style=flat-square
[npm-url]: https://npmjs.org/package/opt-stack

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