Safe integer {\itshape number} primitive\hypertarget{md_sfcode_node_modules_ext_node_modules_type_docs_safe_integer_autotoc_md9982}{}\doxysection{$<$tt$>$safe-\/integer/coerce$<$/tt$>$}\label{md_sfcode_node_modules_ext_node_modules_type_docs_safe_integer_autotoc_md9982}
Follows \href{integer.md\#integercoerce}{\texttt{ {\ttfamily integer/coerce}}} but returns {\ttfamily null} in place of values which are beyond {\ttfamily Number.\+MIN\+\_\+\+SAFE\+\_\+\+INTEGER} and {\ttfamily Number.\+MAX\+\_\+\+SAFE\+\_\+\+INTEGER} range.


\begin{DoxyCode}{0}
\DoxyCodeLine{const coerceToSafeInteger = require("{}type/safe-\/integer/coerce"{});}
\DoxyCodeLine{}
\DoxyCodeLine{coerceToInteger("{}12.95"{}); // 12}
\DoxyCodeLine{coerceToInteger(9007199254740992); // null}
\DoxyCodeLine{coerceToInteger(null); // null }

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


\begin{DoxyCode}{0}
\DoxyCodeLine{const ensureSafeInteger = require("{}type/safe-\/integer/ensure"{});}
\DoxyCodeLine{}
\DoxyCodeLine{ensureSafeInteger(12.93); // "{}12"{}}
\DoxyCodeLine{ensureSafeInteger(9007199254740992); // Thrown TypeError: null is not a safe integer }

\end{DoxyCode}
 