UNPKG

@adyen/kyc-components

Version:

This guide assumes that you have already an account with Adyen. A legalEntity needs to be created, and you need to have a `legalEntityId` to instatiate a Component.

53 lines (52 loc) 1.68 kB
try { let e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack; n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "72868882-a704-4c09-8d5e-816f5c0595f9", e._sentryDebugIdIdentifier = "sentry-dbid-72868882-a704-4c09-8d5e-816f5c0595f9"); } catch (e) {} var applyDelta = (delta) => (char) => String.fromCharCode(char.charCodeAt(0) + delta); /** * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize#nfkc */ var standardNormalization = (input) => input.normalize("NFKC"); /** * The order here does matter, since the characters matched by each converter may overlap. */ var converters = [ { name: "latin", match: /[!-~]/g, convert: applyDelta(65248) }, { name: "hangul1", match: /[ᄀ-ᄒ]/g, convert: standardNormalization }, { name: "hangul2", match: /[ᅡ-ᅵ]/g, convert: standardNormalization }, { name: "katakana", match: /[\uff60-\uff9f]+/g, convert: standardNormalization }, { name: "extras", match: /[¢£¬¯¦¥₩\u0020|←↑→↓■°]/g, convert: (char) => { return "¢£¬ ̄¦¥₩ |←↑→↓■○"["¢£¬¯¦¥₩ |←↑→↓■°".indexOf(char)]; } } ]; /** * Replaces half-width characters with full-width characters. * Includes Latin characters, Katakana, Hangul and various symbols. */ var toFullWidth = (value) => { let input = value; for (const { match, convert } of converters) input = input.replaceAll(match, convert); return input; }; //#endregion export { toFullWidth as t };