OSDN Git Service

merge dashboard into dev
[bytom/bytom-electron.git] / src / utility / math.js
index 92c2d0c..eb323e4 100644 (file)
@@ -14,3 +14,11 @@ export const formatBytes = function(bytes,decimals) {
     i = Math.floor(Math.log(bytes) / Math.log(k))
   return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i]
 }
+
+export  const splitSlice = function (str, len) {
+  let ret = [ ]
+  for (let offset = 0, strLen = str.length; offset < strLen; offset += len) {
+    ret.push(str.slice(offset, len + offset))
+  }
+  return ret
+}