From e989421722e522f4879a354a15ba14912d7acaaa Mon Sep 17 00:00:00 2001
From: Your Name <123456>
Date: 星期五, 24 二月 2023 16:49:38 +0800
Subject: [PATCH] Merge branch 'master' of https://sinanoaq.cn:8888/r/scienceexperimentweb

---
 src/utils/methods.ts |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/src/utils/methods.ts b/src/utils/methods.ts
new file mode 100644
index 0000000..b4b77c8
--- /dev/null
+++ b/src/utils/methods.ts
@@ -0,0 +1,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
+}

--
Gitblit v1.9.2