"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

exports.default = function (source, functionName, callback) {
  (0, _styleSearch2.default)({ source: source, target: functionName, checkFunctionNames: true }, function (match) {
    if (source[match.endIndex] !== "(") {
      return;
    }
    var parensMatch = (0, _balancedMatch2.default)("(", ")", source.substr(match.startIndex));
    callback(parensMatch.body, match.endIndex + 1);
  });
};

var _balancedMatch = require("balanced-match");

var _balancedMatch2 = _interopRequireDefault(_balancedMatch);

var _styleSearch = require("./styleSearch");

var _styleSearch2 = _interopRequireDefault(_styleSearch);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }