     function: (elem) ->
         # arguments
         args = ''
-        if args and elem.params+''
+        if args and String(elem.params)
             args += ","
-        args += elem.params+''
+        args += String(elem.params)
 
         # body
-        {body} = elem
-        if babel
-            body = "(function(){#{body}})"
-            body = babel.transform(body, presets: ['es2015']).code
-            body = /{([^]*)}/m.exec(body)?[1]
-        else
-            log.warn.once 'NML functions do not support EcmaScript 6, ' +
-                'because babel is not installed'
-
+        body = transformByBabel elem.body
         "function(#{args}){#{body}}"
     object: (elem) ->
         json = {}

'use strict'

try
    babel = require 'babel-core'
bundle = require './bundle'
parser = require './parser'
bindingParser = require 'src/binding/parser'

ids = idsKeys = itemsKeys = extensions = queries = requires = null
itemsDeclarations = afterItemCode = null
fileUid = 0

transformByBabel = (body) ->
    body = "(function(){#{body}})"
    body = babel.transform(body, presets: ['es2015']).code
    body = /{([^]*)}/m.exec(body)?[1]
    body

isAnchor = (obj) ->
    assert obj.type is ATTRIBUTE, "isAnchor: type must be an attribute"
