main
Last change
on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
886 bytes
|
Line | |
---|
1 | 'use strict';
|
---|
2 | var globalThis = require('../internals/global-this');
|
---|
3 | var userAgent = require('../internals/environment-user-agent');
|
---|
4 |
|
---|
5 | var process = globalThis.process;
|
---|
6 | var Deno = globalThis.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.