Created
December 28, 2015 16:31
-
-
Save SangHakLee/4da6159a7a08cdd12132 to your computer and use it in GitHub Desktop.
check some value is empty ( include empty array, empty object and exclude number 0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 넘어온 값이 빈값인지 체크합니다. | |
// !value 하면 생기는 논리적 오류를 제거하기 위해 | |
// 명시적으로 value == 사용 | |
// [], {} 도 빈값으로 처리 | |
var isEmpty = function(value){ | |
if( value == "" || value == null || value == undefined || ( value != null && typeof value == "object" && !Object.keys(value).length ) ){ | |
return true | |
}else{ | |
return false | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This gist is
deprecated
.Use https://gist.github.com/SangHakLee/5b92c5c16f2e828a6e9ab2d37ef53a9e