1.4.2 • Published 6 years ago

credit-card-space v1.4.2

Weekly downloads
31
License
MIT
Repository
github
Last release
6 years ago

semantic-release

Credit Card Space

Formats input with a space after every 4 digits. Unlike other credit card number formatters it respects card numbers more then 16 digits.

You can set any split pattern with data-pattern input attribute. '4 4 4 4' is default pattern.

Usage

As module

import CreditCardSpace from 'credit-card-space';

const input = document.querySelector('#card_number');
const ccSpace = new CreditCardSpace(input);

const cardNumber = ccSpace.value();

In browser

Add link into your page:

<script src="node_modules/credit-card-space/dist/credit-card-space.min.js"></script>
<input data-pattern="4 2 2 2 2 4">

You've got global CreditCardSpace constructor:

var input = document.querySelector('input');
var ccInput = new CreditCardSpace(input);

Try it on test page

1.4.2

6 years ago

1.4.1

6 years ago

1.4.0

6 years ago

1.3.1

7 years ago

1.3.0

7 years ago

1.2.0

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3-pre

7 years ago

1.0.2

7 years ago

1.0.0

7 years ago