Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
beganovich committed Aug 5, 2024
1 parent 436a07c commit b87780e
Showing 1 changed file with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Simple Card

Tiny library to help you with credit card inputs.

## Installation

### npm
```bash
npm i @invoiceninja/simple-card
```

## Usage

```html
<form>
<input
type="text"
name="number"
placeholder="0000 0000 0000 0000"
id="number"
/>

<input type="text" name="date" placeholder="mm/yy" id="date" />
<input type="text" name="number" placeholder="000" id="cvv" />
</form>
```

```js
const simpleCard = new SimpleCard({
fields: {
card: {
number: "#number",
cvv: "#cvv",
date: "#date",
},
},
}).mount();
```

### Available methods

#### Check if the fields are valid:
```js
simpleCard.check()
```

#### Get the credit card type:
```js
simpleCard.type() // visa, mastercard .. or unknown.
```

## Contributing

### Requirements

- Node.js 20.x

You can start by cloning repository locally using git.

```bash
git clone https://github.com/invoiceninja/simple-card.git
npm i
npm run dev
```

The demo is provided in demo.html available after starting the dev server (http://localhost:5173).

## Licence
The MIT License (MIT).

0 comments on commit b87780e

Please sign in to comment.