MCPcopy Create free account
hub / github.com/ampproject/amphtml / evalMajorVersion_

Function evalMajorVersion_

src/preact/utils/platform.js:138–147  ·  view source on GitHub ↗

* @param {!RegExp} expr * @param {number} index The index in the result that's interpreted as the * major version (integer). * @return {number}

(expr, index)

Source from the content-addressed store, hash-verified

136 * @return {number}
137 */
138 evalMajorVersion_(expr, index) {
139 if (!self.navigator.userAgent) {
140 return 0;
141 }
142 const res = self.navigator.userAgent.match(expr);
143 if (!res || index >= res.length) {
144 return 0;
145 }
146 return parseInt(res[index], 10);
147 },
148
149 /**
150 * Returns the minor ios version in string.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected