diff --git a/lib/bemhtml/runtime/index.js b/lib/bemhtml/runtime/index.js index f29eb0d7..50f9dfeb 100644 --- a/lib/bemhtml/runtime/index.js +++ b/lib/bemhtml/runtime/index.js @@ -117,13 +117,10 @@ BEMHTML.prototype.recompileInput = function recompileInput(code) { var out = code.toString(); var args = BEMHTML.locals; - if (typeof code === 'function') { - var start = out.match(/^function\s*\(([^{]+)\)\s*{/); - // Reuse function if it already has right arguments - if (start !== null && start[1].split(/,\s*/).length === args.length) - return code; - } + // Reuse function if it already has right arguments + if (typeof code === 'function' && code.length === args.length) + return code; // Strip the function out = out.replace(/^function[^{]+{|}$/g, '');