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

Return undefined or null if an item was not found #582

Closed
ipalfy opened this issue Mar 27, 2023 · 2 comments
Closed

Return undefined or null if an item was not found #582

ipalfy opened this issue Mar 27, 2023 · 2 comments

Comments

@ipalfy
Copy link

ipalfy commented Mar 27, 2023

By the way: This is a much needed and amazing library.

I will use it to create openAPI-Specification „on the fly“, by intercepting all requests in an express middleware and turning these into an openAPI document just by using the api.

Unfortunately my code is full of try/catch, since I have to check if a path/operation entry already exists. A simple check for „false“ would greatly improve my code.

@Belphemur
Copy link
Owner

Hey,

Sorry that I took so long to answer.

This is a great idea, I plan to add a default parameter to the get method so you can choose what to return if it's not found :)

github-actions bot pushed a commit that referenced this issue Apr 9, 2023
# [2.2.0](v2.1.5...v2.2.0) (2023-04-09)

### Bug Fixes

* **Array:** Fix issue with array that have numerical property key ([db7b5cb](db7b5cb)), closes [#571](#571)

### Features

* **getObjectDefault:** Add method `getObjectDefault` to get an object or a default value when the path is leading to non existing data. ([d47786b](d47786b)), closes [#582](#582)
@github-actions
Copy link
Contributor

github-actions bot commented Apr 9, 2023

🎉 This issue has been resolved in version 2.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants