UNPKG

num-pad

Version:

Simple function to pad the passed in number, if less than 10 return 0<num> otherwise just returns the number.

9 lines (6 loc) 235 B
'use strict'; module.exports = exports = function (num) { /* If not a number OR the NaN value return empty string */ if (typeof num !== "number" || num !== num) return ""; return (num > 0 && num < 10) ? "0" + num : "" + num; }