You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+14-15Lines changed: 14 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,9 +13,8 @@
13
13
5.[How to Contribute](#how-to-contribute)
14
14
15
15
## Overview
16
-
**NestedFetch** provides syntactic sugar 🍬 to deal with a nested python `dictionary` or a nested `list` 🐍.<br>
17
-
You can `get`, `set`, `update` and `flatten` values from a deeply nested dictionary or a list with a more concise, easier and a more `KeyError`, `IndexError` free way 😌. <br>
18
-
You can further `flatten` lists of lists having the same depth.
16
+
-**NestedFetch** provides syntactic sugar 🍬 to deal with a nested python `dictionary` or a nested `list` 🐍
17
+
- You can `get`, `set`, `update` and `flatten` values from a deeply nested dictionary or a list with a more concise, easier and a `KeyError`, `IndexError` free way 😌
19
18
20
19
```python
21
20
data = {
@@ -85,7 +84,7 @@ flatten => Specifies whether to flatten the returned value
85
84
Returns the fetched value if it exists, or returns specified default value
86
85
```
87
86
88
-
1.**Fetch** simple nested data :
87
+
-**Fetch** simple nested data :
89
88
90
89
```python
91
90
data = {
@@ -100,7 +99,7 @@ res = nested_get(data,['details','address','city'])
100
99
# res = Albuquerque
101
100
```
102
101
103
-
2.**Fetch** simple nested data with `default` value:
102
+
-**Fetch** simple nested data with `default` value:
104
103
105
104
```python
106
105
data = {
@@ -115,7 +114,7 @@ res = nested_get(data,['details','address','state'], default=-1)
115
114
# res = -1
116
115
```
117
116
118
-
3.**Fetch** nested data:
117
+
-**Fetch** nested data:
119
118
120
119
```python
121
120
data = {
@@ -132,7 +131,7 @@ res = nested_get(data,['details','address','city'])
132
131
# res = ['Albuquerque','El Paso']
133
132
```
134
133
135
-
4.**Fetch** nested data with `default` value:
134
+
-**Fetch** nested data with `default` value:
136
135
137
136
```python
138
137
data = {
@@ -151,7 +150,7 @@ res = nested_get(data,['details','address','city'], default= None)
151
150
# res = ['Albuquerque','El Paso', None]
152
151
```
153
152
154
-
5.**Fetch** nested data by specifing `index`:
153
+
-**Fetch** nested data by specifing `index`:
155
154
156
155
```python
157
156
data = {
@@ -168,7 +167,7 @@ res = nested_get(data,['details','address','city', 0])
168
167
# res = Albuquerque
169
168
```
170
169
171
-
6.**Fetch** nested data without `flatten`:
170
+
-**Fetch** nested data without `flatten`:
172
171
173
172
```python
174
173
data = {
@@ -202,7 +201,7 @@ res = nested_get(data,['matches','goals','scorrer'])
202
201
# res = [['Lionel Messi', 'Luis Suarez'], ['C. Ronaldo']]
203
202
```
204
203
205
-
8.**Fetch** nested data with `flatten`:
204
+
-**Fetch** nested data with `flatten`:
206
205
207
206
```python
208
207
data = {
@@ -252,7 +251,7 @@ Returns the number of values updated
252
251
```
253
252
254
253
255
-
1.**Update** value of simple nested data :
254
+
-**Update** value of simple nested data :
256
255
257
256
```python
258
257
data = {
@@ -277,7 +276,7 @@ res = nested_set(data,['details','address','city'], "Denver")
277
276
278
277
```
279
278
280
-
2.**Update** nested data:
279
+
-**Update** nested data:
281
280
282
281
```python
283
282
data = {
@@ -305,7 +304,7 @@ res = nested_set(data,['details','address','city'], "Denver")
305
304
# }
306
305
```
307
306
308
-
3.**Update** nested data with `index`:
307
+
-**Update** nested data with `index`:
309
308
310
309
```python
311
310
data = {
@@ -333,7 +332,7 @@ res = nested_set(data,['details','address',0,'city'], "Denver")
0 commit comments