         'can not read :' + path + e
 
     # check type
-    ext = path.match /.*(\..*)$/
-    type = ext[1] if ext isnt null and ext[1] isnt null
-    type = '.js' if not extConfig[type]
+    ext = p.extname path
+    type = ext if ext isnt null
+    type = 'js' if not extConfig[type]
 
     lines = content.split '\n'
     counter = 0

fs = require 'fs'

sourceLinesCounter = (path) ->
    

    counter

extConfig = 
    'js': 
        wordsReg: /\w/
        inlineCommentReg: /^\s*\/\//
        blockCommentStartReg: /\s*(\S*)\s*(\/\*)\s*/
        blockCommentEndReg: /(\*\/)\s*(\w)*\s*$/
    'java':
        wordsReg: /\w/
        inlineCommentReg: /^\s*\/\//
        blockCommentStartReg: /\s*(\S*)\s*(\/\*)\s*/
        blockCommentEndReg: /(\*\/)\s*(\w)*\s*$/
    'css':
        wordsReg: /\w/
        inlineCommentReg: /^\s*\/\//
        blockCommentStartReg: /\s*(\S*)\s*(\/\*)\s*/
        blockCommentEndReg: /(\*\/)\s*(\w)*\s*$/
    'coffee':
        wordsReg: /\w/
        inlineCommentReg: /^\s*\/\//
        blockCommentStartReg: /\s*(\S*)\s*(\/\*)\s*/
        blockCommentEndReg: /(\*\/)\s*(\w)*\s*$/
    'html':
        wordsReg: /\w/
        inlineCommentReg: /^\s*\/\//
        blockCommentStartReg: /\s*(\S*)\s*(<!--)\s*/
