# credit-card-space

> Simple plugin that adds space after every 4 digits in credit card input and restricts input for numbers only

Latest version **1.4.2** (published 2018-11-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install credit-card-space
pnpm add credit-card-space
yarn add credit-card-space
bun add credit-card-space
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.4.2 |
| Published | 2018-11-02 |
| First published | 2016-12-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 78.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Ivan Vasilyev |
| Maintainers | konclave |
| Keywords | cc, card, format, formatter |

## Links

- npm: https://www.npmjs.com/package/credit-card-space
- Repository: https://github.com/konclave/credit-card-space
- Homepage: https://github.com/konclave/credit-card-space#readme
- Issues: https://github.com/konclave/credit-card-space/issues
- npm.io page: https://npm.io/package/credit-card-space

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.4.2 (latest) — 2018-11-02
- 1.4.1 — 2018-10-26
- 1.4.0 — 2018-10-26
- 1.3.1 — 2017-07-25
- 1.3.0 — 2017-07-25
- 1.2.0 — 2017-07-25
- 1.1.1 — 2017-07-24
- 1.1.0 — 2016-12-22
- 1.0.5 — 2016-12-21
- 1.0.4 — 2016-12-21
- 1.0.3-pre — 2016-12-20
- 1.0.2 — 2016-12-20
- 1.0.0 — 2016-12-19

## README

[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/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
```js
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:
```html
<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:
```js
var input = document.querySelector('input');
var ccInput = new CreditCardSpace(input);
```

Try it on [test page](https://konclave.github.io/credit-card-space/)

---
_Source: https://npm.io/package/credit-card-space · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
