Add palindrome utility function and corresponding tests#14
Open
callistoVII wants to merge 1 commit into
Open
Conversation
slkueneke
reviewed
Jun 5, 2026
slkueneke
left a comment
There was a problem hiding this comment.
- Adding in comments would make the code a little clearer for someone updating, extending, or maintaining this function
- Instead of returning false when the value passed is not a string, throw a descriptive error so the function's return value differentiates between passing a non-string value and a string that is not a palindrome (both currently return the same value of false).
- It might be clearer to name the files (utility and corresponding tests) the same name as the function for quick finding and consistency.
- Add in a 4th unit test for the use case when a non-string value is passed to the function.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This Pull Request introduces a new utility function, isPalindrome, which determines whether a given string is a palindrome. This feature was implemented as part of Assignment 1.1, focusing on working within a feature branch, writing clean commits, and providing automated tests for validation.
The implementation includes:
The function normalizes input by lower-casing and removing non‑alphanumeric characters before performing the palindrome check. This ensures correct handling of mixed‑case strings, punctuation, and spacing.
No existing project files were modified.
Testing: Three unit tests were added to validate functionality.
To run test suite:
npm install
npm test
All tests pass successfully.
Note for Reviewers -
The feature is fully isolated to the add_palindrome_function branch. No changes were made to the project's main or existing utilities.