UNPKG

@yoroi/portfolio

Version:

The Portfolio package of Yoroi SDK

20 lines (19 loc) 693 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.parseTokenId = exports.isTokenId = exports.TokenIdSchema = void 0; var _zod = require("zod"); const regexId = /^(?:[a-fA-F0-9]+\.?[a-fA-F0-9]*|\.)$/; // TODO: https://github.com/colinhacks/zod/pull/1786 this needs to be migrated to .templateLiterals const TokenIdSchema = _zod.z.string().regex(regexId); exports.TokenIdSchema = TokenIdSchema; const isTokenId = data => { return TokenIdSchema.safeParse(data).success; }; exports.isTokenId = isTokenId; const parseTokenId = data => { return isTokenId(data) ? data : undefined; }; exports.parseTokenId = parseTokenId; //# sourceMappingURL=token-id.js.map