-
-
Notifications
You must be signed in to change notification settings - Fork 0
Added has(), set(), and assertPathExists()
#200
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds three new utility functions (has(), set(), and assertPathExists()) for working with object paths, along with supporting utility types for type-safe path manipulation. The changes enable checking for path existence, setting values at specific paths, and asserting path existence with optional type validation.
Key Changes
- New path manipulation functions: Added
has()for checking path existence,set()for setting values at paths, andassertPathExists()for path existence assertions - Enhanced type system: Added utility types like
FromPath,WithPath,Merge, andParseNumberto support type-safe path operations - Comprehensive test coverage: Added extensive unit tests and type tests for all new functionality
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/has.ts |
Implements has() function with type predicates for path existence checking |
src/set.ts |
Implements set() function for setting values at object paths with prototype pollution protection |
src/assertion/assertPathExists.ts |
Implements assertion function for path existence with optional type validation |
src/types/objects.ts |
Adds utility types FromPath, WithPath, Merge for advanced object path manipulation |
src/types/utils.ts |
Adds ParseNumber utility type for string-to-number parsing |
src/get.ts |
Updates parameter type from string to PropertyKey for consistency |
test/ files |
Comprehensive test coverage for all new functionality |
|
🎉 This PR is included in version 0.69.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
has(),set(), andassertPathExists()