@atlas-kitchen/adyen-web
Version:
3 lines (2 loc) • 1.32 kB
JavaScript
import e from"./specifications.js";const r=(r,t)=>{if(null===t||!e[t]||!e[t].structure)return!1;const s=e[t].structure.match(/(.{3})/g).map((e=>{const r=e.slice(0,1),t=parseInt(e.slice(1),10);let s;switch(r){case"A":s="0-9A-Za-z";break;case"B":s="0-9A-Z";break;case"C":s="A-Za-z";break;case"F":s="0-9";break;case"L":s="a-z";break;case"U":s="A-Z";break;case"W":s="0-9a-z"}return`([${s}]{${t}})`}));return new RegExp(`^${s.join("")}$`)},t=e=>e.replace(/\W/gi,"").replace(/(.{4})(?!$)/g,"$1 ").trim(),s=e=>e.replace(/[^a-zA-Z0-9]/g,"").toUpperCase(),a=(e,t)=>r(0,t),c=e=>{let r=e;const t="A".charCodeAt(0),s="Z".charCodeAt(0);return r=r.toUpperCase(),r=r.substr(4)+r.substr(0,4),r.split("").map((e=>{const r=e.charCodeAt(0);if(r>=t&&r<=s){return r-t+10}return e})).join("")},n=e=>{let r,t=e;for(;t.length>2;)r=t.slice(0,9),t=parseInt(r,10)%97+t.slice(r.length);return parseInt(t,10)%97},l=r=>!(!r||!e[r])&&e[r],i=(e,r,t)=>{if(0===e||!r.length)return 0;const s=r.length-t.length,a=s>0,c=(e,r)=>/\s/.test(e.charAt(r)),n=e-s;return a&&(c(r,n+1)||c(r,n))?e+1:!a&&c(r,e-1)?e-1:e},o=e=>e.slice(0,2);export{s as electronicFormat,t as formatIban,o as getCountryCode,l as getIbanCountrySpecification,i as getNextCursorPosition,c as iso13616Prepare,n as iso7064Mod97_10,r as parseStructure,a as regex};
//# sourceMappingURL=utils.js.map