马宇豪
2023-08-07 7ed4982b8f2a345bfad95a96070143c32142bc61
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
export const isValidKey = (key: string | number | symbol, object:object): key is keyof typeof object =>{
    return key in object;
};
 
export function numFloat(...args: any){
    let numTen = 1
    let numTotal = 1
    for(let i of args){
        if( i === null){
            numTotal = numTotal * 1
        }else if(i.toString().indexOf('.') === -1){
            numTotal = numTotal * Number(i)
        }else{
            numTotal = numTotal * Number(i.toString().split('.')[0] + i.toString().split('.')[1])
            numTen = numTen * Math.pow(10,i.toString().split('.')[1].length)
        }
    }
    return numTotal / numTen
}