# is-answer

> Returns true if an answer to a prompt is not undefined, null, an empty object, empty array, or a string with zero length.

Latest version **0.1.1** (published 2016-12-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install is-answer
pnpm add is-answer
yarn add is-answer
bun add is-answer
```

## 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.1.1 |
| Published | 2016-12-31 |
| First published | 2016-03-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10.0 |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Jon Schlinkert |
| Maintainers | jonschlinkert |
| Keywords | answer, is |

## Links

- npm: https://www.npmjs.com/package/is-answer
- Repository: https://github.com/jonschlinkert/is-answer
- Issues: https://github.com/jonschlinkert/is-answer/issues
- npm.io page: https://npm.io/package/is-answer

## Dependencies (3)

- [has-values](https://npm.io/package/has-values.md) ^0.1.4
- [omit-empty](https://npm.io/package/omit-empty.md) ^0.4.1
- [is-primitive](https://npm.io/package/is-primitive.md) ^2.0.0

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 0.1.1 (latest) — 2016-12-31
- 0.1.0 — 2016-03-11

## README

# is-answer [![NPM version](https://img.shields.io/npm/v/is-answer.svg)](https://www.npmjs.com/package/is-answer) [![Build Status](https://img.shields.io/travis/jonschlinkert/is-answer.svg)](https://travis-ci.org/jonschlinkert/is-answer)

> Returns true if an answer to a prompt is not undefined, null, an empty object, empty array, or a string with zero length.

## Install

Install with [npm](https://www.npmjs.com/):

```sh
$ npm install is-answer --save
```

## Usage

```js
var isAnswer = require('is-answer');
```

## True

**if the value is a boolean**

```js
isAnswer(true);
isAnswer(false);
//=> true
```

**if the value is a string**

```js
isAnswer('foo');
//=> true
```

**if the value is a number**

```js
isAnswer(0);
isAnswer(1);
//=> true
```

**if the value is an object with values**

```js
isAnswer({a: 'b'});
isAnswer({a: true});
isAnswer({a: false});
isAnswer({a: 0});
//=> true
```

**if the value is an array with values**

```js
isAnswer(['foo']);
isAnswer([true]);
isAnswer([false]);
isAnswer([0]);
//=> true
```

## False

**returns false if the value is an empty string**

```js
isAnswer('');
//=> false
```

**returns false if the value is an empty object**

```js
isAnswer({});
isAnswer({a: {}});
isAnswer({a: undefined});
isAnswer({a: ''});
isAnswer({a: null});
isAnswer({a: {b: {}}});
//=> false
```

**returns false if the value is an empty array**

```js
isAnswer([]);
isAnswer([null]);
isAnswer([undefined]);
isAnswer([{}]);
isAnswer(['']);
//=> false
```

## Contributing

Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/is-answer/issues/new).

## Building docs

Generate readme and API documentation with [verb](https://github.com/verbose/verb):

```sh
$ npm install verb && npm run docs
```

Or, if [verb](https://github.com/verbose/verb) is installed globally:

```sh
$ verb
```

## Running tests

Install dev dependencies:

```sh
$ npm install -d && npm test
```

## Author

**Jon Schlinkert**

* [github/jonschlinkert](https://github.com/jonschlinkert)
* [twitter/jonschlinkert](http://twitter.com/jonschlinkert)

## License

Copyright © 2016 [Jon Schlinkert](https://github.com/jonschlinkert)
Released under the [MIT license](https://github.com/jonschlinkert/is-answer/blob/master/LICENSE).

***

_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on March 11, 2016._

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