Skip to content

Added a method to safely trim whitespaces from string#57

Open
DeshmukhHrishikesh wants to merge 1 commit into
swanandapps:mainfrom
DeshmukhHrishikesh:patch-4
Open

Added a method to safely trim whitespaces from string#57
DeshmukhHrishikesh wants to merge 1 commit into
swanandapps:mainfrom
DeshmukhHrishikesh:patch-4

Conversation

@DeshmukhHrishikesh

Copy link
Copy Markdown

The safeTrim() method trims whitespace from the beginning and end of a string, similar to JavaScript’s native trim() method. However, it adds an extra layer of safety by handling null, undefined, and non-string inputs without throwing errors.

If the input is not a valid string, the function returns an empty string instead of failing.

The safeTrim() method trims whitespace from the beginning and end of a string, similar to JavaScript’s native trim() method. However, it adds an extra layer of safety by handling null, undefined, and non-string inputs without throwing errors.

If the input is not a valid string, the function returns an empty string instead of failing.
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