var extend = require('extend')
var fs = require('fs')
var Handlebars = require('handlebars')

module.exports = plugin

function plugin (options) {
  options = extend({
    directory: 'helpers'
  }, options || {})

  return function (files, metalsmith, done) {
    fs.readdir(metalsmith.path(options.directory), function (err, files) {
      if (err) throw err

      files.forEach(function (file) {
        var helperContents
        var path
        var templateName

        path = metalsmith.path(options.directory, file)
        helperContents = require(path)

        switch (typeof helperContents) {
        case 'function':
          templateName = file.split('.').shift()
          Handlebars.registerHelper(templateName, helperContents)
          break
        case 'object':
          Handlebars.registerHelper(helperContents)
          break
        }
      })

      done()
    })
  }
}

@@ -603,24 +603,26 @@
 ) %7B%0A        
+  
 case 'functi
@@ -636,16 +636,18 @@
         
+  
 template
@@ -652,16 +652,39 @@
 teName =
+ helperContents.name %7C%7C
  file.sp
@@ -702,32 +702,34 @@
 ift()%0A          
+ 
+ 
 Handlebars.regis
@@ -770,38 +770,42 @@
 ents)%0A          
+  
 break%0A
+  
         case 'ob
@@ -813,32 +813,34 @@
 ect':%0A          
+  
 Handlebars.regis
@@ -857,32 +857,34 @@
 helperContents)%0A
+  
           break%0A

Change preferred templateName to helper methods name