Socket
Book a DemoInstallSign in
Socket

frmt

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

frmt

A utility library to format strings

latest
Source
npmnpm
Version
0.1.61
Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source
      _/_/                              _/
   _/      _/  _/_/  _/_/_/  _/_/    _/_/_/_/
_/_/_/_/  _/_/      _/    _/    _/    _/
 _/      _/        _/    _/    _/    _/
_/      _/        _/    _/    _/      _/_/

frmt

A utility library to format strings.

NPM Version Build Status

Install

npm i --save frmt

Documentation

Functions

Functions

cardNumber(card_number)

Arguments

  • card_number - The inputted card number to be formatted.

Examples

frmt.cardNumber('4111111111111111'); // => 4111 1111 1111 1111
frmt.cardNumber('378282246310005');  // => 3782 822463 10005

expiry(expiry_number)

Arguments

  • expiry_number - The inputted expiry number to be formatted into MM / YYYY or MM / YY.

Examples

frmt.expiry('1114');   // => 11 / 14
frmt.expiry('112014'); // => 11 / 2014

expiryToDate(formatted_expiry)

Arguments

  • formatted_expiry - The output of the expiry method.

Examples

frmt.expiryToDate('11 / 14');   // => 2014-11-01
frmt.expiryToDate('11 / 2014'); // => 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.cvc('1234', '378282246310005');  // => 1234
frmt.cvc('1234', '4111111111111111'); // => 123

dateOfBirth(dob)

Arguments

  • dob - The inputted date of birth to be formatted into DD / MM / YYYY.

Examples

frmt.dateOfBirth('11041988'); // => 11 / 04 / 1988

dateOfBirthToDate(formatted_dob)

Arguments

  • formatted_dob - The output of the dateOfBirth method.

Examples

frmt.dateOfBirthToDate('11 / 04 / 1988'); // => 1988-11-04

Keywords

input

FAQs

Package last updated on 09 Feb 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts