JS::SourceMap::Index - Index into a JS source map


  $index = JS::SourceMap::load(\*STDIN);
  # ...


Instances of this class represent an searchable index into a sourcemap. There are two ways to use it: The lookup method can be used to find the closest element of the map to a line/column in the minified JS code and the let/get methods can be used to iterate over of the elements of the index. Elements of the index are represented by JS::SourceMap::Token instances.

  • new $raw, $tokens, $line_index, $index, $sources

    Contruct a new index. This is normally done via the JS::SourceMap::Decoder class' decode method and not directly by user code.

  • lookup $line, $column

    Given line and column numbers in the minified JS source code mapped by this index, return the location in the map nearest to them, represented by a JS::SourceMap::Token instance.

  • len

    Return the number of tokens in the index.

  • get $index

    Return a token in the index by number.

  • as_string

    Return a human-readable summary of the data in the index.


JS::SourceMap::Decoder, JS::SourceMap::Token


attila <>


ISC/BSD c.f. LICENSE in the source distribution.