diff --git a/ArithmeticServer.js b/ArithmeticServer.ts similarity index 95% rename from ArithmeticServer.js rename to ArithmeticServer.ts index 764039b..0ea4c17 100644 --- a/ArithmeticServer.js +++ b/ArithmeticServer.ts @@ -18,9 +18,9 @@ http.createServer(function (request, response) { ans = 'num must be used with fibonacci pathname!'; } else { - n = parseInt(queryData.num); + let n:number = parseInt(queryData.num); if (n < 0) { - ans = 'no fibonacci response for negative values, num =' + num; + ans = 'no fibonacci response for negative values, num =' + queryData.num; } else { ans = fibonaci(n); @@ -67,11 +67,11 @@ http.createServer(function (request, response) { console.log('running - listening on port ', port); -function fibonaci(n) { +function fibonaci(n:number) { if ((1 == n) || (0 == n) ) { return 1; } else { return (fibonaci(n-1) + fibonaci(n-2)); } -} \ No newline at end of file +} diff --git a/Fibo1.js b/Fibo1.ts similarity index 87% rename from Fibo1.js rename to Fibo1.ts index 6cba7e8..47a0676 100644 --- a/Fibo1.js +++ b/Fibo1.ts @@ -1,7 +1,7 @@ /** * Created by User on 3/17/14. */ -function fibonaci(n) { +function fibonaci(n:number) { if ((1 == n) || (0 == n) ) { return 1; } diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..fe827cd --- /dev/null +++ b/package-lock.json @@ -0,0 +1,19 @@ +{ + "name": "lesson02", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@types/node": { + "version": "12.7.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.7.2.tgz", + "integrity": "sha512-dyYO+f6ihZEtNPDcWNR1fkoTDf3zAK3lAABDze3mz6POyIercH0lEUawUFXlG8xaQZmm1yEBON/4TsYv/laDYg==", + "dev": true + }, + "typescript": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.5.3.tgz", + "integrity": "sha512-ACzBtm/PhXBDId6a6sDJfroT2pOWt/oOnk4/dElG5G33ZL776N3Y6/6bKZJBFpd+b05F3Ct9qDjMeJmRWtE2/g==" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..fbaa976 --- /dev/null +++ b/package.json @@ -0,0 +1,17 @@ +{ + "name": "lesson02", + "version": "1.0.0", + "description": "lesson02 ========", + "main": "ArithmeticServer.js", + "dependencies": { + "typescript": "^3.5.3" + }, + "devDependencies": { + "@types/node": "^12.7.2" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "Ilantc", + "license": "ISC" +} diff --git a/polyn.js b/polyn.ts similarity index 91% rename from polyn.js rename to polyn.ts index 12e1d8a..8493a28 100644 --- a/polyn.js +++ b/polyn.ts @@ -1,7 +1,7 @@ /** * Created by User on 3/17/14. */ -function isPolyndrom(a) { +function isPolyndrom(a:string) { for(var i = 0, j =a.length-1 ; i < j ; i++,j--){ if (a.charAt(i) != a.charAt(j)) { return false;