Developer Guide

1. Install

You can install the npm package:

npm install @phuocng/fake-numbers

or insert the UMD script to your page:

<script src="/vendors/@phuocng/fake-numbers/umd/fake-numbers.min.js"></script>

2. Fake a number

The following sample code generates a fake credit card number. You can replace creditCardwith other namespace that represents othersupported numbers.

— If you are using the npm package:

import { creditCard } from '@phuocng/fake-numbers';

// Fake a credit card number
const number = creditCard.fake();

— If you are using the UMD script:

// Fake a credit card number
const number = FakeNumbers.creditCard.fake();

3. Check a number

The following sample code check if a given number is a valid credit card number. You can replace creditCard with other namespace that represents othersupported numbers.

— If you are using the npm package:

import { creditCard } from '@phuocng/fake-numbers';

// Check a credit card number
const isValid = creditCard.check('given number').valid;

— If you are using the UMD script:

// Check a credit card number
const isValid = FakeNumbers.creditCard.check('given number').valid;
© 2020 Nguyen Huu Phuoc. All rights reserved.
This site is open source