JS数据校验

JS数据校验

 

module.exports = {
    error:'',
    isJSON : function (str){
        if (typeof str == 'string') {
            try {          `              ·            ·                      

if(typeof obj == 'object' && obj ){ return true; }else{ return false; } } catch(e) { console.log('error:'+str+'!!!'+e); return false; } } }, isNumber : function (checkVal){ var reg = /^-?[1-9][0-9]?.?[0-9]*$/; return reg.test(checkVal); } }

 

posted on 2021-04-15 15:01  zhishiyv  阅读(88)  评论(0编辑  收藏  举报

导航