I might keep this inline and do something like:

     getLanguage = (source, config) -> languages[config.forceExt or path.extname(source)]

config is always set when running through code, so there should be no need to check for its existence.