From 2600b363a943b7e235c8cff5054bfc799d2b8e90 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Tue, 8 Dec 2020 17:54:38 +0000 Subject: [PATCH] Format code with prettier This commit fixes the style issues introduced in 0f61272 according to the output from prettier. Details: https://deepsource.io/gh/moulik-deepsource/demo-javascript/transform/9004a141-f22a-4df9-ab79-23629b554d97/ --- index.js | 100 ++++++++++++++++++++++++++----------------------------- 1 file changed, 48 insertions(+), 52 deletions(-) diff --git a/index.js b/index.js index 6c6d6b10..86cbae45 100644 --- a/index.js +++ b/index.js @@ -1,73 +1,69 @@ -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' -}) + bar: "bar", + z: "z", +})((function () {})(), 0); -(function(){ }(), 0); - -function checkYoda(){ - let yoda = true; - if(true == yoda){ - console.log("I am yoda") - } -} \ No newline at end of file +function checkYoda() { + let yoda = true; + if (true == yoda) { + console.log("I am yoda"); + } +}