function notEmpty(value) {
var result;
switch (typeof value) {
case 'string':
// 文字の0を除く
result = (value && value != 0);
break;
case 'object':
// 配列の中身の数チェック
result = (value && Object.keys(value).length);
break;
default:
result = value;
}
return Boolean(result);
}
More than 5 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme