'use strict';

var deepFind = function(obj, path) {

  if ((typeof obj !== "object") | obj === null) {
	  return undefined;
  }
  if (typeof path === 'string') {
    path = path.split('.');
  }

  if (!Array.isArray(path)) {
    path = path.concat();
  }

  return path.reduce(function (o, part) {
    var keys = part.match(/\[(.*?)\]/);
    if (keys) {
      var key = part.replace(keys[0], '');
      return o[key][keys[1]];
    }
    return o[part];
  }, obj);
};

module.exports = deepFind;

'use strict';

var deepFind = function(obj, path) {

  if (((typeof obj !== "object") && (typeof obj !== "function")) | obj === null) {
	  return undefined;
  }
  if (typeof path === 'string') {
    path = path.split('.');
  }

  if (!Array.isArray(path)) {
    path = path.concat();
  }

  return path.reduce(function (o, part) {
    var keys = part.match(/\[(.*?)\]/);
    if (keys) {
      var key = part.replace(keys[0], '');
      return o[key][keys[1]];
    }
    return o[part];
  }, obj);
};

module.exports = deepFind;

Add capability to retrieve properties of functions
Add capability to retrieve properties of functions
