# 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._