_/_/ _/
_/ _/ _/_/ _/_/_/ _/_/ _/_/_/_/
_/_/_/_/ _/_/ _/ _/ _/ _/
_/ _/ _/ _/ _/ _/
_/ _/ _/ _/ _/ _/_/
frmt
A utility library to format strings.
Install
npm i --save frmt
Documentation
Functions
Functions
cardNumber(card_number)
Arguments
card_number
- The inputted card number to be formatted.
Examples
frmt; // => 4111 1111 1111 1111frmt; // => 3782 822463 10005
expiry(expiry_number)
Arguments
expiry_number
- The inputted expiry number to be formatted intoMM / YYYY
orMM / YY
.
Examples
frmt; // => 11 / 14frmt; // => 11 / 2014
expiryToDate(formatted_expiry)
Arguments
formatted_expiry
- The output of the expiry method.
Examples
frmt; // => 2014-11-01frmt; // => 2014-11-01
cvc(cvc, card_number)
Arguments
cvc
- The CVC to be formatted.card_number
- The card number to know which rules to apply on the cvc.
Examples
frmt; // => 1234frmt; // => 123
dateOfBirth(dob)
Arguments
dob
- The inputted date of birth to be formatted intoDD / MM / YYYY
.
Examples
frmt; // => 11 / 04 / 1988
dateOfBirthToDate(formatted_dob)
Arguments
formatted_dob
- The output of the dateOfBirth method.
Examples
frmt; // => 1988-11-04