Added has(), set(), and assertPathExists()#200
Merged
webdeveric merged 10 commits intomasterfrom Jul 20, 2025
Merged
Conversation
There was a problem hiding this comment.
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 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
has(),set(), andassertPathExists()