parent
2c0b476394
commit
6beae61640
1 changed files with 14 additions and 0 deletions
@ -0,0 +1,14 @@ |
||||
const pad = ( |
||||
value: unknown, |
||||
{ |
||||
fillString = '0', |
||||
maxLength = 2, |
||||
which = 'Start', |
||||
}: { |
||||
fillString?: string; |
||||
maxLength?: number; |
||||
which?: 'Start' | 'End'; |
||||
} = {}, |
||||
): string => String(value)[`pad${which}`](maxLength, fillString); |
||||
|
||||
export default pad; |
Loading…
Reference in new issue