.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / unset-value / node_modules / has-values / index.js
1 /*!
2  * has-values <https://github.com/jonschlinkert/has-values>
3  *
4  * Copyright (c) 2014-2015, Jon Schlinkert.
5  * Licensed under the MIT License.
6  */
7
8 'use strict';
9
10 module.exports = function hasValue(o, noZero) {
11   if (o === null || o === undefined) {
12     return false;
13   }
14
15   if (typeof o === 'boolean') {
16     return true;
17   }
18
19   if (typeof o === 'number') {
20     if (o === 0 && noZero === true) {
21       return false;
22     }
23     return true;
24   }
25
26   if (o.length !== undefined) {
27     return o.length !== 0;
28   }
29
30   for (var key in o) {
31     if (o.hasOwnProperty(key)) {
32       return true;
33     }
34   }
35   return false;
36 };