refactor: Renamed js to nodejs

- feat: Added util module
This commit is contained in:
Aerex
2019-12-01 12:30:20 -05:00
parent 294f16e5da
commit 5518fdbe91
4 changed files with 24 additions and 12 deletions

View File

@@ -25,6 +25,7 @@ Y A H R
P I
*/
const { assert } = require('../../util/js');
/**
* @param {string} s
* @param {number} numRows
@@ -95,7 +96,8 @@ let s, numRows;
s = 'PAYPALISHIRING';
numRows = 3;
console.log(convert(s, numRows));
sol = 'PAHNAPLSIIGYIR';
assert(convert(s, numRows) == sol, 'Output: "PAHNAPLSIIGYIR"');
/* Test Case 2
* Input: s = "PAYPALISHIRING", numRows = 4
@@ -103,7 +105,8 @@ console.log(convert(s, numRows));
*/
s = 'PAYPALISHIRING';
numRows = 4;
console.log(convert(s, numRows));
sol = 'PINALSIGYAHRPI';
assert(convert(s, numRows) == sol, 'Output: "PINALSIGYAHRPI"');
/* Test Case 3
* Input: s = "AB", numRows = 1
@@ -111,4 +114,5 @@ console.log(convert(s, numRows));
*/
s = 'AB';
numRows = 1;
console.log(convert(s, numRows));
sol = 'AB';
assert(convert(s, numRows) == sol, 'Output: "AB"');