https://github.com/grovertb/json-recursive
Recursive library for json maintenance
https://github.com/grovertb/json-recursive
crud json object recursive
Last synced: 2 months ago
JSON representation
Recursive library for json maintenance
- Host: GitHub
- URL: https://github.com/grovertb/json-recursive
- Owner: grovertb
- Created: 2017-04-21T23:03:34.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-04-26T15:38:16.000Z (about 9 years ago)
- Last Synced: 2024-10-30T05:58:04.098Z (over 1 year ago)
- Topics: crud, json, object, recursive
- Language: JavaScript
- Homepage:
- Size: 9.77 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
json-recursive
============
[](https://github.com/grovertb/json-recursive/stargazers)
[](https://github.com/grovertb/json-recursive/issues)
[](https://github.com/grovertb/json-recursive)
```javascript
var collection = [
{
"nombre": "Villareal",
"numero": 1,
"carreras": [
{
"nombre": "Fisico",
"rating": 4.3,
"cursos": [
{
"nombre": "cuantica",
"id": 1
},
{
"nombre": "algebra",
"id": 2
}
]
},
{
"nombre": "Matematica",
"rating": 4,
"cursos": [
{
"nombre": "algebra",
"id": 2
},
{
"nombre": "Aritmetica",
"id": 3
}
]
}
]
},
{
"nombre": "San Marcos",
"numero": 2,
"carreras": [
{
"nombre": "Medicina",
"rating": 9.6,
"cursos": [
{
"nombre": "Quimica",
"id": 4
},
{
"nombre": "Biologia",
"id": 5
}
]
},
{
"nombre": "Metalurgia",
"rating": 5,
"cursos": [
{
"nombre": "quimica",
"id": 4
},
{
"nombre": "Fisica",
"id": 5
}
]
}
]
}
]
```
## Functions
```javascript
var jr = require('json-recursive');
```
## findAll
```javascript
jr.findAll(collection, { 'carreras.cursos.nombre': 'cuantica'})
```
## updateAll
```javascript
jr.updateAll(collection, {'carreras.cursos.nombre': 'cuantica'}, {'nombre': 'mecanica'})
```
## pushAll
```javascript
jr.pushAll(collection,{'carreras.cursos.nombre': 'quimica'}, {'nombre': 'javascript', 'id': 6})
```
## removeAll
```javascript
jr.removeAll(collection, {'carreras.cursos.nombre': 'algebra'})
```