get-double-digit

v0.0.3arrow_drop_down
v0.0.3
v0.0.2
v0.0.1
STATUS
Passing
DOWNLOADS
0
LICENSE
MIT
VISIBILITY
Public
PUBLISHED
7 years ago
SIZE
569 B
Returns a number as at least a two-digits number (with leading zero if required).
1 contributor
Install get-double-digit as a package?
Copied
npm i @bit/tomlandau.simple-js.format-date.get-double-digit
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.cloud
Component Example
React
React
Vue
Angular
React Native
Add dependency... help_outline
Just
import
any of the 1 million components
and packages in Bit or NPM to the example.
import Button from '@bit/grommet.grommet.button';
import Lodash from 'lodash';
toggle layout
No preview available
modifieddraft
chevron_left
chevron_right
getDoubleDigit (
num:number
) : string

Returns a number as at least a two-digits number (with leading zero if required).

Example
getDoubleDigit(24) => 24
getDoubleDigit(245) => 245
getDoubleDigit(2) => 02
Argument
num: number
Returns
string

Test Summary

getDoubleDigit should return same number for a double digit number

Pass

getDoubleDigit should return same number for a triple digit number

Pass

getDoubleDigit should return number with leading zero for a single digit number

Pass

getDoubleDigit should return same number for a negative number

Pass

getDoubleDigit should return number with leading zero for a single digit number, served as a string

Pass

getDoubleDigit should not try to change argument if it`s not a number

Pass
Help and resources