stdlib/source_map/vlq.rb in opal-0.10.0.beta2 vs stdlib/source_map/vlq.rb in opal-0.10.0.beta3
- old
+ new
@@ -26,15 +26,16 @@
# Returns a VLQ String.
def self.encode(ary)
result = []
ary.each do |n|
vlq = n < 0 ? ((-n) << 1) + 1 : n << 1
- begin
+ loop do
digit = vlq & VLQ_BASE_MASK
vlq >>= VLQ_BASE_SHIFT
digit |= VLQ_CONTINUATION_BIT if vlq > 0
result << BASE64_DIGITS[digit]
- end while vlq > 0
+ break unless vlq > 0
+ end
end
result.join
end
# Public: Decode a VLQ string.