UNPKG

@akashicpay/sdk

Version:

SDK to interact with the Akashic ecosystem

22 lines 752 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.prefixWithAS = prefixWithAS; exports.removeASPrefix = removeASPrefix; const L2RegexWithOptionalPrefix = /^(AS)?[A-Fa-f\d]{64}$/; function prefixWithAS(umid) { const result = L2RegexWithOptionalPrefix.exec(umid); if (!result) throw new Error(`${umid} does not match regex with or without prefix`); if (result[1]) return umid; return `AS${umid}`; } function removeASPrefix(umid) { const result = L2RegexWithOptionalPrefix.exec(umid); if (!result) throw new Error(`${umid} does not match regex with or without prefix`); if (result[1]) return umid.slice(2); return umid; } //# sourceMappingURL=prefix.js.map