main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
864 bytes
|
Rev | Line | |
---|
[d24f17c] | 1 | 'use strict';
|
---|
| 2 | var global = require('../internals/global');
|
---|
| 3 | var userAgent = require('../internals/engine-user-agent');
|
---|
| 4 |
|
---|
| 5 | var process = global.process;
|
---|
| 6 | var Deno = global.Deno;
|
---|
| 7 | var versions = process && process.versions || Deno && Deno.version;
|
---|
| 8 | var v8 = versions && versions.v8;
|
---|
| 9 | var match, version;
|
---|
| 10 |
|
---|
| 11 | if (v8) {
|
---|
| 12 | match = v8.split('.');
|
---|
| 13 | // in old Chrome, versions of V8 isn't V8 = Chrome / 10
|
---|
| 14 | // but their correct versions are not interesting for us
|
---|
| 15 | version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
|
---|
| 16 | }
|
---|
| 17 |
|
---|
| 18 | // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
|
---|
| 19 | // so check `userAgent` even if `.v8` exists, but 0
|
---|
| 20 | if (!version && userAgent) {
|
---|
| 21 | match = userAgent.match(/Edge\/(\d+)/);
|
---|
| 22 | if (!match || match[1] >= 74) {
|
---|
| 23 | match = userAgent.match(/Chrome\/(\d+)/);
|
---|
| 24 | if (match) version = +match[1];
|
---|
| 25 | }
|
---|
| 26 | }
|
---|
| 27 |
|
---|
| 28 | module.exports = version;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.