https://github.com/chrismichaelps/propaccess
Deep property access library written in TS.
https://github.com/chrismichaelps/propaccess
deep-prop-access dot-notation dot-notation-string prop-access prop-dot-notation
Last synced: 28 days ago
JSON representation
Deep property access library written in TS.
- Host: GitHub
- URL: https://github.com/chrismichaelps/propaccess
- Owner: chrismichaelps
- License: mit
- Created: 2022-07-22T19:10:46.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-07-23T18:06:27.000Z (over 3 years ago)
- Last Synced: 2025-03-13T14:39:01.958Z (11 months ago)
- Topics: deep-prop-access, dot-notation, dot-notation-string, prop-access, prop-dot-notation
- Language: TypeScript
- Homepage:
- Size: 152 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# โ PropAccess
> Deep property access written in TS.
## ๐ฆ Installation
```shell
npm install propaccess
```
### โ
Benefits
- [x] Type safe string with `dot notation` for query nested object.
- [x] Property `autocomplete`
โ Enjoy :) ;) ...
# ๐ Documentation
## `deepPropAccess>(obj: T, key: P):`
```ts
const obj = {
data: {
numberProp: 2,
stringProp: 'code',
nullProp: null,
undefinedProp: undefined,
arrayProp: [1, 2, 3, 4, 5],
deep: {
key: 1,
deep: {
key: 2,
deep: {
key: 3,
},
},
},
},
}
const props = deepPropAccess(obj, 'data.arrayProp')
```
## **:handshake: Contributing**
- Fork it!
- Create your feature branch: `git checkout -b my-new-feature`
- Commit your changes: `git commit -am 'Add some feature'`
- Push to the branch: `git push origin my-new-feature`
- Submit a pull request
---
### **:busts_in_silhouette: Credits**
- [Chris Michael](https://github.com/ChrisMichaelPerezSantiago) (Project Leader, and Developer)
---
### **:anger: Troubleshootings**
This is just a personal project created for study / demonstration purpose and to simplify my working life, it may or may
not be a good fit for your project(s).
---
### **:heart: Show your support**
Please :star: this repository if you like it or this project helped you!\
Feel free to open issues or submit pull-requests to help me improving my work.
---
### **:robot: Author**
_*Chris M. Perez*_
> You can follow me on
> [github](https://github.com/ChrisMichaelPerezSantiago)ย ยทย [twitter](https://twitter.com/Chris5855M)
---
Copyright ยฉ2022 [propaccess](https://github.com/ChrisMichaelPerezSantiago/propaccess).