{"version":3,"file":"resolveFunction.js","sourceRoot":"","sources":["../src/utils/resolveFunction.ts"],"names":[],"mappings":";;AAAA,8CAAiD;AACjD,0CAA6C;AAC7C,6BAA4B;AAE5B;;;;;;;;;IASI;AACJ,yBAAgC,MAAwB,EAAE,OAAa,EAAE,MAAY,EAAE,aAA6B;IAA7B,8BAAA,EAAA,oBAA6B;IAClH,EAAE,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACvB,MAAM,CAAC,MAAM,CAAC;IAChB,CAAC;IAAC,IAAI,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAC5B,EAAE,CAAC,CAAC,OAAO,IAAI,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;YAC3C,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACzB,CAAC;QAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,IAAI,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;YAChD,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACxB,CAAC;IACH,CAAC;IAED,EAAE,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC;QAClB,MAAM,IAAI,cAAc,CAAC,SAAG,CAAC,4BAA0B,MAAM,2BAAwB,CAAC,CAAC,CAAC;IAC1F,CAAC;AACH,CAAC;AAdD,0CAcC","sourcesContent":["import isFunction = require('lodash/isFunction');\nimport isString = require('lodash/isString');\nimport { log } from './log';\n\n/**\n * Resolves a function on the current target object. It first will\n * try and resolve on the context object, then the target object,\n * then an error will be thrown if the method can not be resolved.\n * @private\n * @param {Function|string} method The method or method name.\n * @param {Object} [context] The context object to resolve from.\n * @param {Object} [target] The target object to resolve from.\n * @returns {Function} The resolved function.\n */\nexport function resolveFunction(method?: string|Function, context?: any, target?: any, throwNotFound: boolean = true): any {\n if (isFunction(method)) {\n return method;\n } else if (isString(method)) {\n if (context && isFunction(context[method])) {\n return context[method];\n } else if (target && isFunction(target[method])) {\n return target[method];\n }\n }\n\n if (throwNotFound) {\n throw new ReferenceError(log(`Can not resolve method ${method} on any target Objects`));\n }\n}\n"]}