\href{https://www.patreon.com/bePatron?u=8663953}{\texttt{ }}

Converts a source-\/map from/to different formats and allows adding/changing properties.


\begin{DoxyCode}{0}
\DoxyCodeLine{var convert = require('convert-\/source-\/map');}
\DoxyCodeLine{}
\DoxyCodeLine{var json = convert}
\DoxyCodeLine{  .fromComment('//\# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVpbGQvZm9vLm1pbi5qcyIsInNvdXJjZXMiOlsic3JjL2Zvby5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSIsInNvdXJjZVJvb3QiOiIvIn0=')}
\DoxyCodeLine{  .toJSON();}
\DoxyCodeLine{}
\DoxyCodeLine{var modified = convert}
\DoxyCodeLine{  .fromComment('//\# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVpbGQvZm9vLm1pbi5qcyIsInNvdXJjZXMiOlsic3JjL2Zvby5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSIsInNvdXJjZVJvb3QiOiIvIn0=')}
\DoxyCodeLine{  .setProperty('sources', [ 'SRC/FOO.JS' ])}
\DoxyCodeLine{  .toJSON();}
\DoxyCodeLine{}
\DoxyCodeLine{console.log(json);}
\DoxyCodeLine{console.log(modified); }

\end{DoxyCode}



\begin{DoxyCode}{0}
\DoxyCodeLine{\{"{}version"{}:3,"{}file"{}:"{}build/foo.min.js"{},"{}sources"{}:["{}src/foo.js"{}],"{}names"{}:[],"{}mappings"{}:"{}AAAA"{},"{}sourceRoot"{}:"{}/"{}\}}
\DoxyCodeLine{\{"{}version"{}:3,"{}file"{}:"{}build/foo.min.js"{},"{}sources"{}:["{}SRC/FOO.JS"{}],"{}names"{}:[],"{}mappings"{}:"{}AAAA"{},"{}sourceRoot"{}:"{}/"{}\} }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_convert_source_map_README_autotoc_md6522}{}\doxysection{API}\label{md_sfcode_node_modules_convert_source_map_README_autotoc_md6522}
\hypertarget{md_sfcode_node_modules_convert_source_map_README_autotoc_md6523}{}\doxysubsection{from\+Object(obj)}\label{md_sfcode_node_modules_convert_source_map_README_autotoc_md6523}
Returns source map converter from given object.\hypertarget{md_sfcode_node_modules_convert_source_map_README_autotoc_md6524}{}\doxysubsection{from\+JSON(json)}\label{md_sfcode_node_modules_convert_source_map_README_autotoc_md6524}
Returns source map converter from given json string.\hypertarget{md_sfcode_node_modules_convert_source_map_README_autotoc_md6525}{}\doxysubsection{from\+Base64(base64)}\label{md_sfcode_node_modules_convert_source_map_README_autotoc_md6525}
Returns source map converter from given base64 encoded json string.\hypertarget{md_sfcode_node_modules_convert_source_map_README_autotoc_md6526}{}\doxysubsection{from\+Comment(comment)}\label{md_sfcode_node_modules_convert_source_map_README_autotoc_md6526}
Returns source map converter from given base64 encoded json string prefixed with {\ttfamily //\# source\+Mapping\+URL=...}.\hypertarget{md_sfcode_node_modules_convert_source_map_README_autotoc_md6527}{}\doxysubsection{from\+Map\+File\+Comment(comment, map\+File\+Dir)}\label{md_sfcode_node_modules_convert_source_map_README_autotoc_md6527}
Returns source map converter from given {\ttfamily filename} by parsing {\ttfamily //\# source\+Mapping\+URL=filename}.

{\ttfamily filename} must point to a file that is found inside the {\ttfamily map\+File\+Dir}. Most tools store this file right next to the generated file, i.\+e. the one containing the source map.\hypertarget{md_sfcode_node_modules_convert_source_map_README_autotoc_md6528}{}\doxysubsection{from\+Source(source)}\label{md_sfcode_node_modules_convert_source_map_README_autotoc_md6528}
Finds last sourcemap comment in file and returns source map converter or returns null if no source map comment was found.\hypertarget{md_sfcode_node_modules_convert_source_map_README_autotoc_md6529}{}\doxysubsection{from\+Map\+File\+Source(source, map\+File\+Dir)}\label{md_sfcode_node_modules_convert_source_map_README_autotoc_md6529}
Finds last sourcemap comment in file and returns source map converter or returns null if no source map comment was found.

The sourcemap will be read from the map file found by parsing {\ttfamily \# source\+Mapping\+URL=file} comment. For more info see from\+Map\+File\+Comment.\hypertarget{md_sfcode_node_modules_convert_source_map_README_autotoc_md6530}{}\doxysubsection{to\+Object()}\label{md_sfcode_node_modules_convert_source_map_README_autotoc_md6530}
Returns a copy of the underlying source map.\hypertarget{md_sfcode_node_modules_convert_source_map_README_autotoc_md6531}{}\doxysubsection{to\+JSON(\mbox{[}space\mbox{]})}\label{md_sfcode_node_modules_convert_source_map_README_autotoc_md6531}
Converts source map to json string. If {\ttfamily space} is given (optional), this will be passed to \href{https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/JSON/stringify}{\texttt{ JSON.\+stringify}} when the JSON string is generated.\hypertarget{md_sfcode_node_modules_convert_source_map_README_autotoc_md6532}{}\doxysubsection{to\+Base64()}\label{md_sfcode_node_modules_convert_source_map_README_autotoc_md6532}
Converts source map to base64 encoded json string.\hypertarget{md_sfcode_node_modules_convert_source_map_README_autotoc_md6533}{}\doxysubsection{to\+Comment(\mbox{[}options\mbox{]})}\label{md_sfcode_node_modules_convert_source_map_README_autotoc_md6533}
Converts source map to an inline comment that can be appended to the source-\/file.

By default, the comment is formatted like\+: {\ttfamily //\# source\+Mapping\+URL=...}, which you would normally see in a JS source file.

When {\ttfamily options.\+multiline == true}, the comment is formatted like\+: {\ttfamily /$\ast$\# source\+Mapping\+URL=... $\ast$/}, which you would find in a CSS source file.\hypertarget{md_sfcode_node_modules_convert_source_map_README_autotoc_md6534}{}\doxysubsection{add\+Property(key, value)}\label{md_sfcode_node_modules_convert_source_map_README_autotoc_md6534}
Adds given property to the source map. Throws an error if property already exists.\hypertarget{md_sfcode_node_modules_convert_source_map_README_autotoc_md6535}{}\doxysubsection{set\+Property(key, value)}\label{md_sfcode_node_modules_convert_source_map_README_autotoc_md6535}
Sets given property to the source map. If property doesn\textquotesingle{}t exist it is added, otherwise its value is updated.\hypertarget{md_sfcode_node_modules_convert_source_map_README_autotoc_md6536}{}\doxysubsection{get\+Property(key)}\label{md_sfcode_node_modules_convert_source_map_README_autotoc_md6536}
Gets given property of the source map.\hypertarget{md_sfcode_node_modules_convert_source_map_README_autotoc_md6537}{}\doxysubsection{remove\+Comments(src)}\label{md_sfcode_node_modules_convert_source_map_README_autotoc_md6537}
Returns {\ttfamily src} with all source map comments removed\hypertarget{md_sfcode_node_modules_convert_source_map_README_autotoc_md6538}{}\doxysubsection{remove\+Map\+File\+Comments(src)}\label{md_sfcode_node_modules_convert_source_map_README_autotoc_md6538}
Returns {\ttfamily src} with all source map comments pointing to map files removed.\hypertarget{md_sfcode_node_modules_convert_source_map_README_autotoc_md6539}{}\doxysubsection{comment\+Regex}\label{md_sfcode_node_modules_convert_source_map_README_autotoc_md6539}
Provides {\bfseries{a fresh}} Reg\+Exp each time it is accessed. Can be used to find source map comments.\hypertarget{md_sfcode_node_modules_convert_source_map_README_autotoc_md6540}{}\doxysubsection{map\+File\+Comment\+Regex}\label{md_sfcode_node_modules_convert_source_map_README_autotoc_md6540}
Provides {\bfseries{a fresh}} Reg\+Exp each time it is accessed. Can be used to find source map comments pointing to map files.\hypertarget{md_sfcode_node_modules_convert_source_map_README_autotoc_md6541}{}\doxysubsection{generate\+Map\+File\+Comment(file, \mbox{[}options\mbox{]})}\label{md_sfcode_node_modules_convert_source_map_README_autotoc_md6541}
Returns a comment that links to an external source map via {\ttfamily file}.

By default, the comment is formatted like\+: {\ttfamily //\# source\+Mapping\+URL=...}, which you would normally see in a JS source file.

When {\ttfamily options.\+multiline == true}, the comment is formatted like\+: {\ttfamily /$\ast$\# source\+Mapping\+URL=... $\ast$/}, which you would find in a CSS source file.

\href{https://bitdeli.com/free}{\texttt{ }} 