UNPKG

@noeldemartin/faker

Version:

Generate massive amounts of fake contextual data

2 lines (1 loc) 808 B
"use strict";var l=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var o=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var a=(e,n)=>{for(var r in n)l(e,r,{get:n[r],enumerable:!0})},h=(e,n,r,u)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of o(n))!s.call(e,t)&&t!==r&&l(e,t,{get:()=>n[t],enumerable:!(u=i(n,t))||u.enumerable});return e};var f=e=>h(l({},"__esModule",{value:!0}),e);var p={};a(p,{luhnCheck:()=>g,luhnCheckValue:()=>m});module.exports=f(p);function g(e){return c(e)===0}function m(e){const n=c(e.replace(/L?$/,"0"));return n===0?0:10-n}function c(e){e=e.replace(/[\s-]/g,"");let n=0,r=!1;for(let u=e.length-1;u>=0;u--){let t=parseInt(e.substring(u,u+1));r&&(t*=2,t>9&&(t=t%10+1)),n+=t,r=!r}return n%10}0&&(module.exports={luhnCheck,luhnCheckValue});