0.0.4 • Published 7 years ago

json-recursive v0.0.4

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

json-recursive

GitHub Stars GitHub Issues Current Version

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

var jr = require('json-recursive');

findAll

jr.findAll(collection, { 'carreras.cursos.nombre': 'cuantica'})

updateAll

jr.updateAll(collection, {'carreras.cursos.nombre': 'cuantica'}, {'nombre': 'mecanica'})

pushAll

jr.pushAll(collection,{'carreras.cursos.nombre': 'quimica'}, {'nombre': 'javascript', 'id': 6})

removeAll

jr.removeAll(collection, {'carreras.cursos.nombre': 'algebra'})
0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago