Stripped down version of s\mbox{[}n\mbox{]}printf(3c). We make a best effort to throw an exception when given a format string we don\textquotesingle{}t understand, rather than ignoring it, so that we won\textquotesingle{}t break existing programs if/when we go implement the rest of this.

This implementation currently supports specifying


\begin{DoxyItemize}
\item field alignment (\textquotesingle{}-\/\textquotesingle{} flag),
\item zero-\/pad (\textquotesingle{}0\textquotesingle{} flag)
\item always show numeric sign (\textquotesingle{}+\textquotesingle{} flag),
\item field width
\item conversions for strings, decimal integers, and floats (numbers).
\item argument size specifiers. These are all accepted but ignored, since Javascript has no notion of the physical size of an argument.
\end{DoxyItemize}

Everything else is currently unsupported, most notably\+: precision, unsigned numbers, non-\/decimal numbers, and characters.

Besides the usual POSIX conversions, this implementation supports\+:


\begin{DoxyItemize}
\item {\ttfamily j}\+: pretty-\/print a JSON object (using node\textquotesingle{}s \char`\"{}inspect\char`\"{})
\item {\ttfamily r}\+: pretty-\/print an Error object
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_extsprintf_README_autotoc_md10175}{}\doxysection{Example}\label{md_sfcode_node_modules_extsprintf_README_autotoc_md10175}
First, install it\+: \begin{DoxyVerb}# npm install extsprintf
\end{DoxyVerb}
 Now, use it\+: \begin{DoxyVerb}var mod_extsprintf = require('extsprintf');
console.log(mod_extsprintf.sprintf('hello %25s', 'world'));
\end{DoxyVerb}
 outputs\+: \begin{DoxyVerb}hello                     world
\end{DoxyVerb}
 \hypertarget{md_sfcode_node_modules_extsprintf_README_autotoc_md10176}{}\doxysection{Also supported}\label{md_sfcode_node_modules_extsprintf_README_autotoc_md10176}
{\bfseries{printf}}\+: same args as sprintf, but prints the result to stdout

{\bfseries{fprintf}}\+: same args as sprintf, preceded by a Node stream. Prints the result to the given stream. 