@xmtp/content-type-primitives
Version:
Primitives for building custom XMTP content types
3 lines (2 loc) • 542 B
JavaScript
const r=(r,t)=>r.authorityId===t.authorityId&&r.typeId===t.typeId,t=r=>`${r.authorityId}/${r.typeId}:${r.versionMajor}.${r.versionMinor}`,o=/^([^/]+)\/([^:]+):(\d+)\.(\d+)$/,e=r=>{const t=r.match(o);if(!t)throw new Error(`Invalid content type string: "${r}". Expected format: "authorityId/typeId:majorVersion.minorVersion"`);const[,e,n,i,d]=t;return{authorityId:e,typeId:n,versionMajor:Number(i),versionMinor:Number(d)}};export{e as contentTypeFromString,t as contentTypeToString,r as contentTypesAreEqual};
//# sourceMappingURL=index.js.map