MCPcopy Create free account
hub / github.com/fontsource/fontsource / splitTag

Function splitTag

api/download/src/util.ts:37–57  ·  view source on GitHub ↗
(tag: string)

Source from the content-addressed store, hash-verified

35}
36
37export const splitTag = (tag: string): Tag => {
38 // Parse tag for version e.g roboto@1.1.1
39 const [id, version] = tag.split('@');
40 if (!id) {
41 throw new StatusError(
42 400,
43 'Bad Request. Unable to parse font ID from tag.',
44 );
45 }
46 if (!version) {
47 throw new StatusError(
48 400,
49 'Bad Request. Unable to parse version from tag.',
50 );
51 }
52 if (version.split('.').length !== 3) {
53 throw new StatusError(400, 'Bad Request. Invalid semver version.');
54 }
55
56 return { id, version };
57};

Callers 3

generateManifestItemFunction · 0.90
generateManifestFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected