index.js
function walkBFS (obj, iter) {
  var q = _.map(_.keys(obj), k => {
    return { key: k, path: '["' + k + '"]' }
  })

  var current
  var currentNode
  var retval
  var push = (v, k) => {
    q.push({ key: k, path: current.path + '["' + k + '"]' })
  }
  while (q.length) {
    current = q.shift()
    currentNode = _.get(obj, current.path)
    retval = iter(currentNode, current.key, current.path)
    if (retval) {
      return retval
    }

    if (_.isPlainObject(currentNode) || _.isArray(currentNode)) {
      _.each(currentNode, push)
    }
  }
}
function walkBFS (obj, iter) {
  var q = _.map(_.keys(obj), k => {
    return { key: k, path: '["' + k + '"]' }
  })

  var current
  var currentNode
  var retval
  var push = (v, k) => {
    q.push({ key: k, path: current.path + '["' + k + '"]' })
  }
  while (q.length) {
    current = q.shift()
    currentNode = _.get(obj, current.path)
    retval = iter(currentNode, current.key, current.path)
    if (retval) {
      return retval
    }

    if (_.isPlainObject(currentNode) || _.isArray(currentNode)) {
      _.each(currentNode, push)
    }
  }
}
function walkBFS ( obj , iter ) { var q = _ . map ( _ . keys ( obj ) , k => { return { key : k , path : '["' + k + '"]' } } ) var current var currentNode var retval var push = ( v , k ) => { q . push ( { key : k , path : current . path + '["' + k + '"]' } ) } while ( q . length ) { current = q . shift ( ) currentNode = _ . get ( obj , current . path ) retval = iter ( currentNode , current . key , current . path ) if ( retval ) { return retval } if ( _ . isPlainObject ( currentNode ) || _ . isArray ( currentNode ) ) { _ . each ( currentNode , push ) } } }
walks the object in level-order invokes iter at each node if iter returns truthy, breaks & returns the value assumes no cycles
walks the object in level - order invokes iter at each node if iter returns truthy breaks & returns the value assumes no cycles