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

Method evalMajorVersion_

src/service/platform-impl.js:156–165  ·  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

154 * @return {number}
155 */
156 evalMajorVersion_(expr, index) {
157 if (!this.navigator_.userAgent) {
158 return 0;
159 }
160 const res = this.navigator_.userAgent.match(expr);
161 if (!res || index >= res.length) {
162 return 0;
163 }
164 return parseInt(res[index], 10);
165 }
166
167 /**
168 * Returns the minor ios version in string.

Callers 2

getMajorVersionMethod · 0.95
getMajorVersionFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected