DEV Community

Hildor Júnior
Hildor Júnior

Posted on

My first Vue npm package

So basically i just published my first npm package.

It is a Vue component that displays a reactive credit card preview for payment forms.

You can download it from NPM or see the code in the Github repo.

Showcase GIF

What you think about it?

Please leave your suggestions in the comments.

I hope you guys like it!

Top comments (9)

Collapse
 
htndev profile image
Oleksandr Vanilchuk

Very nice Hildor!
But I think, you need to refactor your code.
For example:

[
'636368', '438935',
'504175', '451416',
'509048', '509067',
'509049', '509069',
'509050', '509074',
'509068', '509040',
'509045', '509051',
'509046', '509066',
'509047', '509042',
'509052', '509043',
'509064', '509040',
].includes(cNumber.slice(0, 6))

It's mystic numbers that can't give any description. I hope you won't stop and will continue developing your pretty component!

Collapse
 
hildorjr profile image
Hildor Júnior

Thanks for replying, so in this case what do you suggest? Maybe assigning the array to a "const brandNumbers"?

Collapse
 
htndev profile image
Oleksandr Vanilchuk

I can recommend you to create @/constants.js and import it.
In the future, it will help you to scale your component.

Thread Thread
 
hildorjr profile image
Hildor Júnior

Right, great idea, i will be implementing this soon!

Thanks, Alexandr.

Thread Thread
 
htndev profile image
Oleksandr Vanilchuk

Feel free to contact me.
I'm interested to write the same component for my own project. :)

Collapse
 
alyatek profile image
alyatek

You didn't share any link to the package. How can we install it?

Collapse
 
hildorjr profile image
Hildor Júnior

lol, you are right, i didn't even notice, thanks, i put the link in the post.

Collapse
 
tilakmaddy_68 profile image
Tilak Madichetti

so cvc is 4 numbers ?

Collapse
 
hildorjr profile image
Hildor Júnior

yes, usually is 3 or 4 depending on the card brand.