"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = findNode;

var _reactDom = require("react-dom");

function findNode(target, param) {
  if (!target) {
    return null;
  }

  if (typeof target === 'string') {
    return document.getElementById(target);
  }

  if (typeof target === 'function') {
    target = target(param);
  }

  if (!target) {
    return null;
  }

  try {
    return (0, _reactDom.findDOMNode)(target);
  } catch (err) {
    return target;
  }
}