Skip to content

feat(whitelist, blacklist): enhance efficiency and error handling with optimizations #2572

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: master
Choose a base branch
from

Conversation

avadootharajesh
Copy link

This PR introduces optimizations to both the whitelist and blacklist functions in the string validation module. The key changes are: Efficiency improvements: Updated regex handling for both functions to escape special characters properly and ensure that unnecessary operations are minimized.

Improved error handling: The functions now throw more precise error messages when chars is not provided as a string.

Documentation update: Both functions have been updated with more detailed and accurate JSDoc comments to improve clarity for developers.

The whitelist function has also been added to ensure only characters from the provided chars string are retained, complementing the existing blacklist function which removes characters from the string.

References:
The structure of data to be validated remains consistent with the previous functions; no structural changes to the data input or output are required.

Checklist

  • PR contains only changes related; no stray files, etc.
  • README updated (where applicable)
  • Tests written (where applicable)
  • References provided in PR (where applicable)

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.

1 participant