empty Checker
empty Checker
"use strict";
/**
*
* @author xgqfrms
* @license MIT
* @copyright xgqfrms
*
* @description Utils & emptyChecker();
* @augments
* @example
*
* @param {String} key
* @param {Boolean} debug
*/
const emptyChecker = (key = ``, debug = false) => {
let result = true,
strKey = `${key}`;
switch (strKey) {
case "undefined":
result = false;
break;
case "null":
result = false;
break;
case "":
result = false;
break;
case "--":
result = false;
break;
// case "0":
// result = false;
// break;
case -1.7976931348623157e+308:
result = false;
break;
default:
break;
}
if (debug) {
console.log(`key =`, key);
console.log(`strKey =`, strKey);
console.log(`result =`, result);
}
return result;
};
export default emptyChecker;
export {
emptyChecker
};
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/10881556.html
未经授权禁止转载,违者必究!