\hypertarget{md_sfcode_node_modules_source_list_map_README_autotoc_md28223}{}\doxysection{API}\label{md_sfcode_node_modules_source_list_map_README_autotoc_md28223}
\hypertarget{md_sfcode_node_modules_source_list_map_README_autotoc_md28224}{}\doxysubsection{Example}\label{md_sfcode_node_modules_source_list_map_README_autotoc_md28224}

\begin{DoxyCode}{0}
\DoxyCodeLine{var SourceListMap = require("{}source-\/list-\/map"{}).SourceListMap;}
\DoxyCodeLine{}
\DoxyCodeLine{// Create a new map}
\DoxyCodeLine{var map = new SourceListMap();}
\DoxyCodeLine{}
\DoxyCodeLine{// Add generated code that is map line to line to some soure}
\DoxyCodeLine{map.add("{}Generated\(\backslash\)ncode1\(\backslash\)n"{}, "{}source-\/code.js"{}, "{}Orginal\(\backslash\)nsource"{});}
\DoxyCodeLine{}
\DoxyCodeLine{// Add generated code that isn't mapped}
\DoxyCodeLine{map.add("{}Generated\(\backslash\)ncode2\(\backslash\)n"{});}
\DoxyCodeLine{}
\DoxyCodeLine{// Get SourceMap and generated source}
\DoxyCodeLine{map.toStringWithSourceMap(\{ file: "{}generated-\/code.js"{} \});}
\DoxyCodeLine{// \{}
\DoxyCodeLine{//   source: 'Generated\(\backslash\)ncode1\(\backslash\)nGenerated\(\backslash\)ncode2\(\backslash\)n',}
\DoxyCodeLine{//   map: \{}
\DoxyCodeLine{//      version: 3,}
\DoxyCodeLine{//      file: 'generated-\/code.js',}
\DoxyCodeLine{//      sources: [ 'source-\/code.js' ],}
\DoxyCodeLine{//      sourcesContent: [ 'Orginal\(\backslash\)nsource' ],}
\DoxyCodeLine{//      mappings: 'AAAA;AACA;;;'}
\DoxyCodeLine{//    \}}
\DoxyCodeLine{// \}}
\DoxyCodeLine{}
\DoxyCodeLine{// Convert existing SourceMap into SourceListMap}
\DoxyCodeLine{// (Only the first mapping per line is preserved)}
\DoxyCodeLine{var fromStringWithSourceMap = require("{}source-\/list-\/map"{}).fromStringWithSourceMap;}
\DoxyCodeLine{var map = fromStringWithSourceMap("{}Generated\(\backslash\)ncode"{}, \{ version: 3, ... \});}

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_source_list_map_README_autotoc_md28225}{}\doxysubsection{$<$tt$>$new Source\+List\+Map()$<$/tt$>$}\label{md_sfcode_node_modules_source_list_map_README_autotoc_md28225}
\hypertarget{md_sfcode_node_modules_source_list_map_README_autotoc_md28226}{}\doxysubsection{$<$tt$>$\+Source\+List\+Map.\+prototype.\+add$<$/tt$>$}\label{md_sfcode_node_modules_source_list_map_README_autotoc_md28226}

\begin{DoxyCode}{0}
\DoxyCodeLine{SourceListMap.prototype.add(generatedCode: string)}
\DoxyCodeLine{SourceListMap.prototype.add(generatedCode: string, source: string, originalSource: string)}
\DoxyCodeLine{SourceListMap.prototype.add(sourceListMap: SourceListMap) }

\end{DoxyCode}


Append some stuff.\hypertarget{md_sfcode_node_modules_source_list_map_README_autotoc_md28227}{}\doxysubsection{$<$tt$>$\+Source\+List\+Map.\+prototype.\+prepend$<$/tt$>$}\label{md_sfcode_node_modules_source_list_map_README_autotoc_md28227}

\begin{DoxyCode}{0}
\DoxyCodeLine{SourceListMap.prototype.prepend(generatedCode: string)}
\DoxyCodeLine{SourceListMap.prototype.prepend(generatedCode: string, source: string, originalSource: string)}
\DoxyCodeLine{SourceListMap.prototype.prepend(sourceListMap: SourceListMap) }

\end{DoxyCode}


Prepend some stuff.\hypertarget{md_sfcode_node_modules_source_list_map_README_autotoc_md28228}{}\doxysubsection{$<$tt$>$\+Source\+List\+Map.\+prototype.\+to\+String()$<$/tt$>$}\label{md_sfcode_node_modules_source_list_map_README_autotoc_md28228}
Get generated code.\hypertarget{md_sfcode_node_modules_source_list_map_README_autotoc_md28229}{}\doxysubsection{$<$tt$>$\+Source\+List\+Map.\+prototype.\+to\+String\+With\+Source\+Map$<$/tt$>$}\label{md_sfcode_node_modules_source_list_map_README_autotoc_md28229}

\begin{DoxyCode}{0}
\DoxyCodeLine{SourceListMap.prototype.toStringWithSourceMap(options: object) }

\end{DoxyCode}


Get generated code and Source\+Map. {\ttfamily options} can contains {\ttfamily file} property which defines the {\ttfamily file} property of the Source\+Map.\hypertarget{md_sfcode_node_modules_source_list_map_README_autotoc_md28230}{}\doxysubsection{$<$tt$>$\+Source\+List\+Map.\+prototype.\+map\+Generated\+Code$<$/tt$>$}\label{md_sfcode_node_modules_source_list_map_README_autotoc_md28230}

\begin{DoxyCode}{0}
\DoxyCodeLine{SourceListMap.prototype.mapGeneratedCode(fn: function) : SourceListMap }

\end{DoxyCode}


Applies {\ttfamily fn} to each generated code block (per line). The returned value is set as new generated code. Returns a new Source\+List\+Map.

Removing and adding lines is supported. The Source\+Map complexity will increase when doing this.\hypertarget{md_sfcode_node_modules_source_list_map_README_autotoc_md28231}{}\doxysection{Test}\label{md_sfcode_node_modules_source_list_map_README_autotoc_md28231}
\href{https://travis-ci.org/webpack/source-list-map}{\texttt{ }}\hypertarget{md_sfcode_node_modules_source_list_map_README_autotoc_md28232}{}\doxysection{License}\label{md_sfcode_node_modules_source_list_map_README_autotoc_md28232}
Copyright (c) 2017 JS Foundation

MIT (\href{http://www.opensource.org/licenses/mit-license.php}{\texttt{ http\+://www.\+opensource.\+org/licenses/mit-\/license.\+php}}) 