'use strict';

var deepFind = function(obj, path) {
  if (typeof path === 'string') {
    path = path.split('.');
  }

  if (typeof path === 'array') {
    path = path;
  }

  for (var i = 0; i < path.length; i++) {
    if ((/\[[0-9]]/).test(path[i])) {
      var keyIndex = path[i].split('[')
      obj = obj[keyIndex[0]][parseInt(keyIndex[1], 10)]
    } else {
      obj = obj[path[i]];
    }

    if (!obj) {
      return false;
    }
  }
  return obj;
}

module.exports = deepFind;

@@ -122,31 +122,27 @@
 if (
-typeof path === 'array'
+Array.isArray(path)
 ) %7B%0A
@@ -156,16 +156,25 @@
 h = path
+.concat()
 ;%0A  %7D%0A%0A 

fix array type check and create a path copy for further use