fix(striker-ui): consolidate string padding

main
Tsu-ba-me 2 years ago
parent 2c0b476394
commit 6beae61640
  1. 14
      striker-ui/lib/pad.ts

@ -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…
Cancel
Save