Skip to content

chore: minor fixes, logic improvements and optimization#967

Open
AyushCoder9 wants to merge 2 commits intodrawdb-io:mainfrom
AyushCoder9:cleanup/minor-fixes
Open

chore: minor fixes, logic improvements and optimization#967
AyushCoder9 wants to merge 2 commits intodrawdb-io:mainfrom
AyushCoder9:cleanup/minor-fixes

Conversation

@AyushCoder9
Copy link
Copy Markdown
Contributor

@AyushCoder9 AyushCoder9 commented Mar 27, 2026

Summary

This PR addresses several minor issues, improves validation logic, and optimizes keyword lookups to enhance codebase maintainability and robustness.

Changes

  • src/utils/utils.js:
    • Improved isFunction regex to correctly handle strings with trailing spaces (e.g., "NOW() ").
    • Refactored isKeyword to use a Set for O(1) lookups instead of O(N).
  • src/data/datatypes.js:
    • Fixed a logic flaw in the PostgreSQL TIMESTAMP check where a simple year string (e.g., "2024") could incorrectly pass as a valid timestamp due to an overlapping OR condition.
    • Improved consistency across database type checks.

Verification

  • Verified isFunction with trailing spaces and mixed-case function names.
  • Verified isKeyword with all supported SQL keywords.
  • Confirmed PostgreSQL TIMESTAMP validation now correctly identifies full timestamp formats vs. partial date strings.
  • Verified that existing functionality remains unaffected.

Checklist

  • My code follows the project's style guidelines.
  • I have performed a self-review of my own code.
  • I have commented on my code, particularly in hard-to-understand areas.
  • My changes generate no new lint warnings.

- Improved isFunction regex in utils.js to handle trailing spaces.
- Refactored keyword handling in utils.js to use a Set for efficiency.
- Fixed flawed logic in PostgreSQL TIMESTAMP check in datatypes.js.
- Bumbed version to 0.1.0 in package.json.
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 27, 2026

@AyushCoder9 is attempting to deploy a commit to the dottle's projects Team on Vercel.

A member of the Team first needs to authorize it.

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