朱桂飞
2023-12-19 8cc072a8a3bffcb8e9292cd39d1062493a1a0282
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
module.exports = {
    error:'',
    isJSON : function (str){
        if (typeof str == 'string') {
            try {
                var obj=JSON.parse(str);
                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);
    }
}