Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kartikesingh/read-nested-object

Read a nested property of an object
https://github.com/kartikesingh/read-nested-object

Last synced: 24 days ago
JSON representation

Read a nested property of an object

Awesome Lists containing this project

README

        

# Installations
```
npm i read-nested-object
```

# What ?
With this module you can read nested object with keys like "name.first", "hobby.real.0" etc

# How ?
```js
const readObject = require('read-nested-object');

// import readObject from "./" // for typescript

const ob = {
name: {
first: "Shisui",
last: "Uchiha",
},
hobby: {
real: ["sleeping", "wasting time"],
fake: ["coding", "gaming"]
}
}

console.log(readObject(ob,"name.first")); // output => Shisui
console.log(readObject(ob,"hobby.real.0")); // output => sleeping
```

# Supports
For support or issues or queries contace me on my [discord server](https://discord.gg/XYnMTQNTFh), If you find any bug create a issue [here](https://github.com/KartikeSingh/read-nested-object/issues).