{\itshape number} primitive\hypertarget{md_sfcode_node_modules_ext_node_modules_type_docs_number_autotoc_md9960}{}\doxysection{$<$tt$>$number/coerce$<$/tt$>$}\label{md_sfcode_node_modules_ext_node_modules_type_docs_number_autotoc_md9960}
Restricted number coercion. Returns number presentation for every value that follows below constraints


\begin{DoxyItemize}
\item is implicitly coercible to number
\item is neither {\ttfamily null} nor {\ttfamily undefined}
\item is not {\ttfamily NaN} and doesn\textquotesingle{}t coerce to {\ttfamily NaN}
\end{DoxyItemize}

For all other values {\ttfamily null} is returned


\begin{DoxyCode}{0}
\DoxyCodeLine{const coerceToNumber = require("{}type/number/coerce"{});}
\DoxyCodeLine{}
\DoxyCodeLine{coerceToNumber("{}12"{}); // 12}
\DoxyCodeLine{coerceToNumber(\{\}); // null}
\DoxyCodeLine{coerceToNumber(null); // null }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_ext_node_modules_type_docs_number_autotoc_md9961}{}\doxysection{$<$tt$>$number/ensure$<$/tt$>$}\label{md_sfcode_node_modules_ext_node_modules_type_docs_number_autotoc_md9961}
If given argument is a number coercible value (via \href{\#numbercoerce}{\texttt{ {\ttfamily number/coerce}}}) returns result number. Otherwise {\ttfamily Type\+Error} is thrown.


\begin{DoxyCode}{0}
\DoxyCodeLine{const ensureNumber = require("{}type/number/ensure"{});}
\DoxyCodeLine{}
\DoxyCodeLine{ensureNumber(12); // "{}12"{}}
\DoxyCodeLine{ensureNumber(null); // Thrown TypeError: null is not a number }

\end{DoxyCode}
 