Permalink
Browse files

Improved coding convention and messages.

  • Loading branch information...
1 parent 36a3e03 commit a82aecc008ef9827609f412417b0a09632ce70f2 @blmarket blmarket committed Feb 23, 2014
Showing with 9 additions and 9 deletions.
  1. +4 −4 lib/coffee-script/coffee-script.js
  2. +5 −5 src/coffee-script.coffee

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -158,13 +158,13 @@ exports.eval = (code, options = {}) ->
exports.register = -> require './register'
-# Throw Error to register extension explicitly.
+# Throw error with deprecation warning when depending upon implicit `require.extensions` registration
if require.extensions
for ext in @FILE_EXTENSIONS
- unless require.extensions[ext]?
- require.extensions[ext] = ->
- throw new Error('''Use CoffeeScript.register() or the coffee-script/register module \
- to dynamically load CoffeeScript files''')
+ require.extensions[ext] ?= ->
+ throw new Error """
+ Use CoffeeScript.register() or require the coffee-script/register module to require #{ext} files.
+ """
exports._compileFile = (filename, sourceMap = no) ->
raw = fs.readFileSync filename, 'utf8'

0 comments on commit a82aecc

Please sign in to comment.