diff --git a/lib/bemhtml/index.js b/lib/bemhtml/index.js index 50402f6c..9ca50b04 100644 --- a/lib/bemhtml/index.js +++ b/lib/bemhtml/index.js @@ -163,6 +163,7 @@ BEMHTML.prototype.renderClose = function(prefix, context, tag, attrs, isBEM, out = context._flush(out); return out; }; + BEMHTML.prototype.renderAttrs = function(attrs) { var out = ''; diff --git a/lib/bemxjst/utils.js b/lib/bemxjst/utils.js index a74654c0..5cf996e8 100644 --- a/lib/bemxjst/utils.js +++ b/lib/bemxjst/utils.js @@ -208,22 +208,22 @@ exports.fnToString = function(code) { return ''; if (typeof code === 'function') { - // Examples: + // Examples for regular function // function () { … } // function name() { … } // function (a, b) { … } // function name(a, b) { … } - var regularFunction = /^function\s*[^{]+{|}$/g; - - // Examples: + // + // Examples for arrow function // () => { … } // (a, b) => { … } // _ => { … } - var arrowFunction = /^(_|\(\w|[^=>]+\))\s=>\s{|}$/g; code = code.toString(); code = code.replace( - code.indexOf('function') === 0 ? regularFunction : arrowFunction, + code.indexOf('function') === 0 ? + /^function\s*[^{]+{|}$/g : + /^(_|\(\w|[^=>]+\))\s=>\s{|}$/g, ''); }