Skip to content

London | Nadarajah_Sripathmanathan | Sprint-2 | Week3 #466

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

sripathman
Copy link

Learners, PR Template

Self checklist

  • I have committed my files one by one, on purpose, and for a reason
  • I have titled my PR with COHORT_NAME | FIRST_NAME LAST_NAME | REPO_NAME | WEEK
  • I have tested my changes
  • My changes follow the style guide
  • My changes meet the requirements of this task

Changelist

Briefly explain your PR.

Questions

Ask any questions you have for your reviewer.

@sripathman
Copy link
Author

Dear admin , I have done step 3 sprint -2 . could you review please

@sripathman sripathman added the Needs Review Participant to add when requesting review label Apr 5, 2025
Copy link
Contributor

@cjyuan cjyuan left a comment

Choose a reason for hiding this comment

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

Code looks great. Feel free to mark this as "Complete" anytime.

Comment on lines +2 to 23
function createLookup(items, keySelector, valueSelector) {
if (!Array.isArray(items)) {
return {};
}

if (typeof keySelector !== 'function' || typeof valueSelector !== 'function') {
throw new Error('keySelector and valueSelector must be functions');
}

const lookup = {};

for (const item of items) {
const key = keySelector(item);
const value = valueSelector(item);

if (key !== undefined) {
lookup[key] = value;
}
}

return lookup;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. Why not just accept two strings as the 2nd and 3rd parameters and write lines 14-15 as
  const key = item[keySelector]
  const value = item[valueSelector]

?

const decodedKey = decodeURIComponent(key.replace(/\+/g, " "));

// Decode value, but do not replace "+" with spaces
const decodedValue = value ? decodeURIComponent(value) : null;
Copy link
Contributor

Choose a reason for hiding this comment

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

What's your rationale behind not treating + in the value as space?

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review 👀 Review Git Changes requested to do with Git and removed Needs Review Participant to add when requesting review labels Apr 7, 2025
@cjyuan
Copy link
Contributor

cjyuan commented Apr 7, 2025

Can you fix this branch so that it does not contain any modified files in the Sprint-1 folder?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👀 Review Git Changes requested to do with Git Reviewed Volunteer to add when completing a review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants