dot-diver
dot-diver copied to clipboard
A lightweight, powerful, and dependency-free TypeScript utility library that provides types and functions to work with object paths in dot notation.
```js const fields = { foo: 'bar' }; console.log(getByPath(fields, '')); // undefined setByPath(fields, '', 'baz'); console.log(fields); // { "": "baz", foo: "bar" } ``` Expected ```js const fields = {...
Next
fix https://github.com/clickbar/dot-diver/issues/3 fix https://github.com/clickbar/dot-diver/issues/4 fix https://github.com/clickbar/dot-diver/issues/5 Partially fixes https://github.com/clickbar/dot-diver/issues/2 Updates behavior for https://github.com/clickbar/dot-diver/issues/30 We use the currently given path (typed by the user) as an offset to only show the...
Example Type: ```ts export type ExampleType = { id: number } & Record ``` Here `test_data.foo` is not a valid path in `getByPath` and will throw a typescript error.
`setByPath()` uses the `Path` type, which does not differ between readonly and writeable properties. So the auto completion contains paths to properties, which are readonly. We should create an extra...
Let's consider the following cases: ```typescript type TestType = { a: number | { nested: string } } type value = PathValue // is string ``` Here, the type of...
Currently, if a type has many cyclic dependencies (see [readme-question](https://github.com/clickbar/dot-diver#-i-get-the-error-type-instantiation-is-excessively-deep-and-possibly-infinitets2589)), TypeScript fails due to the large number of possible paths. If circular constraints were better supported (see https://github.com/microsoft/TypeScript/issues/51011), an alternative...
See title. If we have a object inside a object with an index signature, all paths of the nested objects are getting truncated. Example: ```ts type TestType = { [index:...
Currently, we do not exposed the depth parameter, since interference of other generic Parameters (e.g. Path, PathValue) would stop. See this issue for further information: https://github.com/microsoft/TypeScript/issues/26242 This would kill the...
Here is a demo https://play.vuejs.org/#eNp9VU1v20YQ/StjXkghLOUmPRSJlMIpckgPtdEavZhGwFBDaW1yl9hdSjYU/fe+2aVkxjaii5bz8ea9mVlyn1z0fbEdOHmfLFxtVe/JsR/6j6VWXW+spz1Zrmqvtpzj1ORUm64fPK/oQI01HaVIT0td6mbQiDNaEP6r2oEv/FXlN5n5dpdTj1NOWzHPaI9wP5/Tl4b8hoOPVoadTj3gta+UpgoWn4tf046prjTdDS7QC0kBqhAg1VB2JhiF0nU7rNhlaZHOxjKlR/0bcd/SMmZFs4VOC9qlPwj7QOgSyHanHLSipmao9IZc36pYNDBVWmy87lh7R5Ve0a5q70F3pyVohEJVrpFlmWnQXrWC2ChEC5BV642nvq1qDhVeiEIbgtixyjKULgKToE5iWmRpdpjFZSy2lKriaYylTNwKtvMP+FucsIqW9RoyfqFf4Xjz5tSnWPKeH5FzDL5Rt9H5rM708QYp0tuXtu/faS/NDR3+AeLmVOAVWreTSYXZRGZsrbHSCqxhtj+gBdEOsV2wxjXNIIfGYOTPPggCGnytOjaDz7IZLT+KZnq+qDGnCJVzSntrGtVy0Sjr/FdddZzCeg0VqYAecnp7fn4e8Sfbv2b/6THgSYm4BrkcwxUodeg3yZ6Du9gurK2k55k8zH6cMQLjnj5FFpZXQ81ZVg/WonPxbl1V1j8JI5JLEU9E/rFn09AYT2fLJaWRV4oRHaOO7iXcemjbiessDq1AR7wRtGJTucudvrKmZ+sfi7pq21f4xPxRsPxGLYNeMa4Cr6I9zHjiHoHCpRUcrCCC8rGXQH2+FG/RveNraZyvLEUxDnQc5B+TSZ6WJ4S8TH8a4gTo9Z2YhTkt5vH1iRcnHjx3uNue8US0WKltOBBpgFXtRV2zc+9pv4/sD4fFNztGnAqf3AeoBcg8oizmE+wkT7yDjkatiztnNN7iodVlInLA0172spOuTAAXC5QJZmV2fwWbt9j0o73ecH3/iv3OPYitTK4sO7ZbLpOTz1cWjKP7879/8wPOJ2dnVkOL6J84/2Fn2kE4xrBPWA3QnsQFtl/Ct0jp9bX7/OBZu6MoIRq3I+rGt+jPn0h/ovuu+C3kYZnQxa9btoKJBsJRvPs9OfwPJ2xysQ== The issue is because of the hasOwnProperty check coming from the global Object prototype and not the Proxy one, the path which doesn't yet exist...