From 95efda962a5098e941213f557c1f4ba204683be9 Mon Sep 17 00:00:00 2001 From: Anto Christopher <93177734+anto-deepsource@users.noreply.github.com> Date: Thu, 6 Oct 2022 12:52:16 +0530 Subject: [PATCH 1/2] Update index.js --- index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/index.js b/index.js index b4cf9bf8..e9ddd79e 100644 --- a/index.js +++ b/index.js @@ -79,6 +79,7 @@ function getEncryptedKey(){ return hash } +// dummy function isMatched(str){ const matches = str.match(/hasTheMagic/)[0] ? process(str) : null; return matches From 5205b567b80c100d4b707f2f63ed908a91b8dc51 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Thu, 6 Oct 2022 07:22:37 +0000 Subject: [PATCH 2/2] Format code with prettier --- index.js | 118 +++++++++++++++++++++++++++---------------------------- 1 file changed, 59 insertions(+), 59 deletions(-) diff --git a/index.js b/index.js index e9ddd79e..96ee6a26 100644 --- a/index.js +++ b/index.js @@ -1,86 +1,86 @@ -function isEven(x){ - if(x = 2 || x % 2 == 0){ - console.log(`${x} is even`) - } else - console.log(`${x} is odd`) +function isEven(x) { + if ((x = 2 || x % 2 == 0)) { + console.log(`${x} is even`); + } else console.log(`${x} is odd`); } -function isNumber(num){ - let x = undefined - x= num % 2 - if(false) { - console.log("Number is false") - } else if (!!x) { - console.log(`Number: ${x}`) - } else if(2 == x){} +function isNumber(num) { + let x = undefined; + x = num % 2; + if (false) { + console.log("Number is false"); + } else if (!!x) { + console.log(`Number: ${x}`); + } else if (2 == x) { + } } function isTruthy(x) { - debugger; - return Boolean(x); -}; + debugger; + return Boolean(x); +} function area(r) { - let math = Math() - return math.PI * r * r; + let math = Math(); + return math.PI * r * r; } -function isFooAvailable(obj){ - console.log(`Value of obj[foo]: ${obj['foo']}`) - return obj.hasOwnProperty('foo') +function isFooAvailable(obj) { + console.log(`Value of obj[foo]: ${obj["foo"]}`); + return obj.hasOwnProperty("foo"); } -function findFooBar(){ - var re = /=foo bar/; - re.test('foobar') +function findFooBar() { + var re = /=foo bar/; + re.test("foobar"); } -function consoleFoo(num){ - while((num != 3)){ - break; - console.log(num--) - } - +function consoleFoo(num) { + while (num != 3) { + break; + console.log(num--); + } } -function isGreaterThan(arr, x){ - if(Array.isArray(arr)){ - arr.map((n) => { - return !(n > x) ? n : arguments.callee(n-1) * n; - }); - }; +function isGreaterThan(arr, x) { + if (Array.isArray(arr)) { + arr.map((n) => { + return !(n > x) ? n : arguments.callee(n - 1) * n; + }); + } } -function callHiEveryMinutes(x){ - if(!window && x){ - setTimeout("alert('Hi')", x * 1000) - - } else window.setTimeout("alert('Hi')", x * 1000) +function callHiEveryMinutes(x) { + if (!window && x) { + setTimeout("alert('Hi')", x * 1000); + } else window.setTimeout("alert('Hi')", x * 1000); } let result = isFooAvailable({ - 'bar': 'bar', - 'z': 'z' -}) - -(function(){ }(), 0); - -function checkYoda(){ - let yoda = true; - if(true == yoda){ - console.log("I am yoda") - } + bar: "bar", + z: "z", +})((function () {})(), 0); + +function checkYoda() { + let yoda = true; + if (true == yoda) { + console.log("I am yoda"); + } } -const crypto = require('crypto') +const crypto = require("crypto"); -function getEncryptedKey(){ - const hash = crypto.createCipheriv('aes-192-ecb', Buffer.from(ENCRYPTION_KEY), iv); - return hash +function getEncryptedKey() { + const hash = crypto.createCipheriv( + "aes-192-ecb", + Buffer.from(ENCRYPTION_KEY), + iv + ); + return hash; } // dummy -function isMatched(str){ - const matches = str.match(/hasTheMagic/)[0] ? process(str) : null; - return matches +function isMatched(str) { + const matches = str.match(/hasTheMagic/)[0] ? process(str) : null; + return matches; }