Skip to content

Commit

Permalink
Showing 2 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -11,6 +11,8 @@ tabs:
key: /uilib/extensions/payment-card/properties
- title: Products
key: /uilib/extensions/payment-card/products
- title: Helpers
key: /uilib/extensions/payment-card/helpers
redirect_from:
- /uilib/patterns/payment-card
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
showTabs: true
---

## Helpers

### formatCardNumber

Formats card number.
Will by default limit the number of characters in the card number to be of 8 characters.
Can be specified by using the `digits` param.

```js
import { formatCardNumber } from '@dnb/eufemia/extensions/PaymentCard'

formatCardNumber(cardNumber: string, digits*: number) // returns string

formatCardNumber('************1337') // returns **** 1337
formatCardNumber('************1337', 5) // returns * 1337
```

#### \* Optional values (defaults)

- length = _8_

0 comments on commit 976c19f

Please sign in to comment.