generated from CodeYourFuture/Module-Template
-
-
Notifications
You must be signed in to change notification settings - Fork 149
London | ITP-May-2025 | Seddiq Azam | Module-Data-Groups | Sprint 2 #578
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
sedazam
wants to merge
37
commits into
CodeYourFuture:main
Choose a base branch
from
sedazam:Sprint-2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
34a63f3
created new prep directory: prep/mean.js
sedazam 54c512a
modified: prep/mean.js
sedazam 21cada7
deleted: prep/mean.js
sedazam e2e39ca
modified: removed [0] and replaced it with address.houseNumber Spri…
sedazam fc5ec4a
modified: changed author.values[author] Sprint-2/debug/author.js
sedazam 05faf71
modified: changed recipe.ingredients.join("\n") Sprint-2/debug/reci…
sedazam f6fee7b
modified: Added comments to Sprint-2/debug/address.js
sedazam 12d95e5
modified: Changed the `Object.values()` Sprint-2/debug/author.js
sedazam d6f0baf
modified: Sprint-2/implement/contains.js
sedazam fd6ad45
new file: Sprint-2/package.json
sedazam 282676a
modified: Sprint-3/package.json
sedazam 330f67a
modified: Sprint-2/implement/contains.js
sedazam fd4ba76
Merge branch 'CodeYourFuture:main' into Sprint-2
sedazam 75cdab9
0da6bcb
modified: Sprint-2/implement/lookup.js
sedazam fc94a75
modified: Sprint-2/implement/lookup.js
sedazam 1df5c85
modified: Fixed to handle values without = sign Sprint-2/implement/…
sedazam 83e6497
modified: Sprint-2/implement/tally.js
sedazam 1f5ee6f
Fix invert function to correctly swap keys and values in the object
sedazam 3d6bdf4
Implement countWords function to count word occurrences in a string
sedazam 2e3464a
Refactor calculateMode function by splitting it into getFrequencies a…
sedazam f9a944e
Fix totalTill function to correctly calculate total amount in pounds …
sedazam 1734c42
undo changes to Sprint 3 package.json file
sedazam 4619e3d
undo the changes to package.json file
sedazam ca5f265
undo changes to package.json file
sedazam 8b4abbd
Update package.json
sedazam 2be54ee
Update package.json
sedazam afbdad0
Implement feature X to enhance user experience and fix bug Y in module Z
sedazam bee93a4
Refactor contains function for improved input validation
sedazam ab5f179
Refactor test syntax for consistency and clarity
sedazam f865aa4
Refactor tally function to use Object.create(null) for result initial…
sedazam b924a9f
Refactor countWords function for improved readability and efficiency
sedazam e893a83
Refactor countWords function to improve punctuation handling and case…
sedazam 2a152c6
Fix totalTill function to return formatted currency and update expect…
sedazam 61584ba
Fix totalTill function to correctly calculate total value and handle …
sedazam 4213201
Fix totalTill function to handle unrecognized coins and update total …
sedazam a2a063e
Merge branch 'main' into Sprint-2
sedazam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
function contains() {} | ||
function contains(obj, property) { | ||
// Safety check: handle invalid inputs | ||
if (typeof obj !== "object" || obj === null || Array.isArray(obj)) { | ||
return false; // Return false for non-object types, null, undefined, or arrays | ||
} | ||
|
||
// Check if the object has the specified property | ||
return obj.hasOwnProperty(property); // Use hasOwnProperty to check for the property | ||
} | ||
|
||
module.exports = contains; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,21 @@ | ||
function createLookup() { | ||
// implementation here | ||
function createLookup(countryCurrencyPairs) { | ||
const result = {}; | ||
|
||
for (let i = 0; i < countryCurrencyPairs.length; i++) { | ||
const pair = countryCurrencyPairs[i]; | ||
const [countryCode, currencyCode] = pair; | ||
|
||
result[countryCode] = currencyCode; | ||
} | ||
|
||
return result; | ||
} | ||
|
||
console.log( | ||
createLookup([ | ||
["US", "USD"], | ||
["CA", "CAD"], | ||
]) | ||
); | ||
|
||
module.exports = createLookup; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,18 @@ | ||
function tally() {} | ||
function tally(inputArray) { | ||
if (!Array.isArray(inputArray)) { | ||
throw new Error("Input must be an array"); | ||
} | ||
|
||
const result = Object.create(null); | ||
|
||
for (const element of inputArray) { | ||
if (result[element]) { | ||
result[element] += 1; | ||
} else { | ||
result[element] = 1; | ||
} | ||
} | ||
return result; | ||
} | ||
console.log(tally(["toString", "toString", "toString"])); | ||
module.exports = tally; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please note that in real querystring, both
key
andvalue
are percent-encoded or URL encoded in the URL. For example, the string "5%" will be encoded as "5%25". So to get the actual value of "5%25" (whether it is a key or value in the querystring), you should call a function to decode it.May I suggest looking up any of these terms, and "How to decode URL encoded string in JS"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
%
%25
%20
&
%26
=
%3D
?
%3F
!
%21
/
%2F
#
%23
"
%22
'
%27
:
%3A
http:
)+
%2B
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are built-in functions you can use to decode the percent-encoded key and value at lines 14 and 18.