Skip to content

inObject(Object,query)

Bhumil Sarvaiya edited this page Aug 25, 2017 · 1 revision

The function will return true if object satisfy the query passed.

var daex = require('json-daex')
var obj = [
  {
    name: 'abc',
    type: 'array',
    age: 20
  },
  {
    name: 'pqr',
    type: 'string',
    age: 20
  },
  {
    name: 'xyz',
    type: 'array',
    age: 22
  },
  {
    name: 'ghi',
    type: 'array',
    age: 20
  },
  {
    name: 'mno',
    type: 'number',
    age: 20
  }
]

console.log(daex.inObject(obj[1],{'type':'array'}))
//check if there exists type: array (key-value pair) in object
// Output: true