MCPcopy Create free account
hub / github.com/denoland/std / isValidVersionNum

Function isValidVersionNum

xml/_common.ts:107–119  ·  view source on GitHub ↗

* Validates a VersionNum per XML 1.0 §2.8. * VersionNum ::= '1.' [0-9]+ * * @returns true if valid, false otherwise

(version: string)

Source from the content-addressed store, hash-verified

105 * @returns true if valid, false otherwise
106 */
107function isValidVersionNum(version: string): boolean {
108 // Must be "1." followed by one or more digits
109 if (version.length < 3 || !version.startsWith("1.")) {
110 return false;
111 }
112 for (let i = 2; i < version.length; i++) {
113 const code = version.charCodeAt(i);
114 if (code < 0x30 || code > 0x39) { // 0-9
115 return false;
116 }
117 }
118 return true;
119}
120
121/**
122 * Validates an EncName per XML 1.0 §4.3.3.

Callers 1

validateXmlDeclarationFunction · 0.85

Calls 1

startsWithMethod · 0.80

Tested by

no test coverage detected