lib/uglifier.rb in uglifier-2.2.1 vs lib/uglifier.rb in uglifier-2.3.0
- old
+ new
@@ -1,9 +1,9 @@
# encoding: UTF-8
require "execjs"
-require "multi_json"
+require "json"
class Uglifier
Error = ExecJS::Error
# Default options for compilation
@@ -34,11 +34,11 @@
:unsafe => false, # Apply "unsafe" transformations
:conditionals => true, # Optimize for if-s and conditional expressions
:comparisons => true, # Apply binary node optimizations for comparisons
:evaluate => true, # Attempt to evaluate constant expressions
:booleans => true, # Various optimizations to boolean contexts
- :loops => true, # Optimize lops when condition can be statically determined
+ :loops => true, # Optimize loops when condition can be statically determined
:unused => true, # Drop unreferenced functions and variables
:hoist_funs => true, # Hoist function declarations
:hoist_vars => false, # Hoist var declarations
:if_return => true, # Optimizations for if/return and if/continue
:join_vars => true, # Join consecutive var statements
@@ -255,18 +255,11 @@
else
false
end
end
- # MultiJson API detection
- if MultiJson.respond_to? :dump
- def json_encode(obj)
- MultiJson.dump(obj)
- end
- else
- def json_encode(obj)
- MultiJson.encode(obj)
- end
+ def json_encode(obj)
+ JSON.dump(obj)
end
def encode_regexp(regexp)
modifiers = if regexp.casefold?
"i"