]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/helpers/core-utils.ts
Use postgres 10 for tests
[github/Chocobozzz/PeerTube.git] / server / helpers / core-utils.ts
index b5bf2c92c75ceab3da1ca7523fcf973147c95d48..9abc532d28741f94c9dec872de8734a32b0f1f41 100644 (file)
@@ -243,6 +243,18 @@ function execShell (command: string, options?: ExecOptions) {
 
 // ---------------------------------------------------------------------------
 
+function isOdd (num: number) {
+  return (num % 2) !== 0
+}
+
+function toEven (num: number) {
+  if (isOdd(num)) return num + 1
+
+  return num
+}
+
+// ---------------------------------------------------------------------------
+
 function promisify0<A> (func: (cb: (err: any, result: A) => void) => void): () => Promise<A> {
   return function promisified (): Promise<A> {
     return new Promise<A>((resolve: (arg: A) => void, reject: (err: any) => void) => {
@@ -310,5 +322,8 @@ export {
   execPromise,
   pipelinePromise,
 
-  parseSemVersion
+  parseSemVersion,
+
+  isOdd,
+  toEven
 }