is-answer
Version:
Returns true if an answer to a prompt is not undefined, null, an empty object, empty array, or a string with zero length.
18 lines (13 loc) • 384 B
JavaScript
/*!
* is-answer <https://github.com/jonschlinkert/is-answer>
*
* Copyright (c) 2016, Jon Schlinkert.
* Licensed under the MIT License.
*/
;
var isPrimitive = require('is-primitive');
var omitEmpty = require('omit-empty');
var has = require('has-values');
module.exports = function(answer) {
return isPrimitive(answer) ? has(answer) : has(omitEmpty(answer));
};