jcq 2 недель назад
Родитель
Сommit
54b6f17046
1 измененных файлов с 15 добавлено и 0 удалено
  1. 15 0
      src/utils/ipUpdate.ts

+ 15 - 0
src/utils/ipUpdate.ts

@@ -0,0 +1,15 @@
+// src/utils/ipUpdate.ts
+
+const ipSplicing = (startIp: string, endIp: string | null | undefined): string => {
+  if (!endIp || endIp.trim() === '') {
+    return startIp;
+  }
+
+  const startParts = startIp.split('.');
+  const endParts = endIp.split('.');
+  const lastPartOfEndIp = endParts[endParts.length - 1];
+
+  return `${startIp}/${lastPartOfEndIp}`;
+};
+
+export { ipSplicing };