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

Query result always in array #18

Closed
sophiebremer opened this issue Feb 27, 2024 · 0 comments · Fixed by #19
Closed

Query result always in array #18

sophiebremer opened this issue Feb 27, 2024 · 0 comments · Fixed by #19
Assignees
Labels
Feature Request New feature request
Milestone

Comments

@sophiebremer
Copy link
Member

Is your feature request related to a problem? Please describe.
When nothing has been found or the query is malformed, undefined is returned. One can not distinguish between both situations. It also bloats the code to handle undefined results.

Describe the solution you'd like
Malformed query should result in an exception, otherwise query should always return an array. One can test with result[0], if something has been found.

Describe alternatives you've considered
The current solution requires access with optional shorthand or fallbacks.

Additional context
jQuery always returns an array.

@sophiebremer sophiebremer added the Feature Request New feature request label Feb 27, 2024
@sophiebremer sophiebremer added this to the v0.4.0 milestone Feb 27, 2024
@sophiebremer sophiebremer self-assigned this Feb 27, 2024
@sophiebremer sophiebremer linked a pull request Feb 28, 2024 that will close this issue
@sophiebremer sophiebremer changed the title Query result always an array Query result always in array Feb 28, 2024
sophiebremer added a commit that referenced this issue Feb 29, 2024
- Add #18; XMLTree.query results always in array
- Add SyntaxError to XMLSelector.parse
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request New feature request
Development

Successfully merging a pull request may close this issue.

1 participant