Skip to content

Fix fib#6

Open
fahadabd1 wants to merge 6 commits intomainfrom
fixFib
Open

Fix fib#6
fahadabd1 wants to merge 6 commits intomainfrom
fixFib

Conversation

@fahadabd1
Copy link
Copy Markdown
Collaborator

No description provided.

@fahadabd1
Copy link
Copy Markdown
Collaborator Author

I edited fibRoutes.ts file to handle what the errors stated, and fixed the import problem. Then tested the code and made sure that it passes all the tests.

Copy link
Copy Markdown
Collaborator

@Frenzy-code Frenzy-code left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, I don't think we needed to replace the equality check but overall pretty good as it just werks.
please go over the comments and review them one by one.

Comment thread src/fib.ts
if (n < 0) {
return -1;
} else if (n == 0) {
} else if (n === 0) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't really need the strict equality here since we know that n is of type Number

Comment thread src/fibRoute.ts
let result = `fibonacci(${num}) is ${fibN}`;
export default function fibRoute(req: Req, res: Res): void {
const numParam = req.params.num; // no more unsafe access
if (!(typeof numParam === "string" )) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

Comment thread src/fibRoute.ts
}

const retVal = fibonacci(n);
let result = "";
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

over-engineered

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants