-
Notifications
You must be signed in to change notification settings - Fork 6
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
Added "_path" and "_name" properties to ObjPathProxy #6
base: master
Are you sure you want to change the base?
Conversation
@@ -1,4 +1,10 @@ | |||
export interface ObjPath { | |||
_pathString: string |
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.
I'd suggest using Symbols instead of underscored prop names. This would also make them private.
return proxy as any as ObjPathProxy<T, T>; | ||
} | ||
|
||
export function getPath<TRoot, T>(proxy: ObjProxyArg<TRoot, T>): PropertyKey[] { |
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.
Removing those functions makes this lib incompatible with previous version. That would be a breaking change.
If the reason of adding the _path prop was to cache path instead of computing it every time, I'd suggest returning the _path
value in the getPath
function
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.
Hello Simon!
Thank you for spending your time on making this PR. I appreciate it!
I left a few suggestions in the inline comments.
… set and get functions a proxy or a function
This adds the ability to get the path of the ObjPathProxy object without having to use the "getPath" function every time.
Exemple: