module Sprockets::SourceMapUtils

def compare_source_offsets(a, b)

Returns -1 if a < b, 0 if a == b and 1 if a > b.

b - Array [line, column]
a - Array [line, column]

Compatible with Array#sort.

Public: Compare two source map offsets.
def compare_source_offsets(a, b)
  diff = a[0] - b[0]
  diff = a[1] - b[1] if diff == 0
  if diff < 0
    -1
  elsif diff > 0
    1
  else
    0
  end
end