lib/minjs/ecma262/literal.rb in minjs-0.4.1 vs lib/minjs/ecma262/literal.rb in minjs-0.4.2
- old
+ new
@@ -425,12 +425,12 @@
# @see Base#to_js
def to_js(options = {})
dq = @val.to_s.each_codepoint.select{|x| x == 0x22}.length
sq = @val.to_s.each_codepoint.select{|x| x == 0x27}.length
if dq <= sq
- t = "\""
+ t = "\"".dup
else
- t = "\'"
+ t = "\'".dup
end
@val.to_s.each_codepoint do |c|
if c == 0x5c
t << ('\\\\')