]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - shared/core-utils/miscs/miscs.ts
Try to reduce CSS size
[github/Chocobozzz/PeerTube.git] / shared / core-utils / miscs / miscs.ts
index a3921b568bdb3cba8bcac63ef904772a0676a634..71703faacbd39acb32b5031b0502d5ae279c12b0 100644 (file)
@@ -1,3 +1,4 @@
+// high excluded
 function randomInt (low: number, high: number) {
   return Math.floor(Math.random() * (high - low) + low)
 }
@@ -11,7 +12,7 @@ function compareSemVer (a: string, b: string) {
   const l = Math.min(segmentsA.length, segmentsB.length)
 
   for (let i = 0; i < l; i++) {
-    const diff = parseInt(segmentsA[ i ], 10) - parseInt(segmentsB[ i ], 10)
+    const diff = parseInt(segmentsA[i], 10) - parseInt(segmentsB[i], 10)
 
     if (diff) return diff
   }
@@ -19,7 +20,17 @@ function compareSemVer (a: string, b: string) {
   return segmentsA.length - segmentsB.length
 }
 
+function isPromise (value: any) {
+  return value && typeof value.then === 'function'
+}
+
+function isCatchable (value: any) {
+  return value && typeof value.catch === 'function'
+}
+
 export {
   randomInt,
-  compareSemVer
+  compareSemVer,
+  isPromise,
+  isCatchable
 }