其他分享
首页 > 其他分享> > 非空判断

非空判断

作者:互联网

const isEmpty = (obj: any) => { let isEmpty = false if (obj === undefined || obj === null || obj === '') { isEmpty = true } else if (Array.isArray(obj) && obj.length === 0) { isEmpty = true } else if (obj.constructor === Object && Object.keys(obj).length === 0) { isEmpty = true } return isEmpty }

标签:非空,判断,obj,Object,else,length,isEmpty,true
来源: https://www.cnblogs.com/oliverYan/p/15791434.html