Skip to content
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

feat: Add isMongoId function to check for valid MongoId #89

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

omarangaritaj
Copy link

This commit introduces a new function, isMongoId, that checks if a given string is a valid MongoDB ID. The function has been exported in the main index file and includes unit tests to ensure proper validation.

This commit introduces a new function, `isMongoId`, that checks if a given string is a valid MongoDB ID. The function has been exported in the main index file and includes unit tests to ensure proper validation.
@mesqueeb
Copy link
Owner

@omarangaritaj thank you very much, but I'm a bit hesitant for this one. 😅 this is very specific to the mongo library. If I allow this, don't we also need detection of isFirestoreId? And then the list goes on of services....

What I'm trying to say, I'm not sure I want to integrate service specific functions into is-what, and keep is-what more about just vanilla JS/TS/NodeJS

@omarangaritaj
Copy link
Author

@omarangaritaj thank you very much, but I'm a bit hesitant for this one. 😅 this is very specific to the mongo library. If I allow this, don't we also need detection of isFirestoreId? And then the list goes on of services....

What I'm trying to say, I'm not sure I want to integrate service specific functions into is-what, and keep is-what more about just vanilla JS/TS/NodeJS

Like a Swiss Army knife, isn't it better to have the tool available if you need it than to need it and not have it?

I just came to your repository because I got tired of doing typo checks: If (new Types.ObjectId('my_mongo_id') )

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.

2 participants