massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / core-js / internals / engine-v8-version.js
1 var global = require('../internals/global');
2 var userAgent = require('../internals/engine-user-agent');
3
4 var process = global.process;
5 var Deno = global.Deno;
6 var versions = process && process.versions || Deno && Deno.version;
7 var v8 = versions && versions.v8;
8 var match, version;
9
10 if (v8) {
11   match = v8.split('.');
12   // in old Chrome, versions of V8 isn't V8 = Chrome / 10
13   // but their correct versions are not interesting for us
14   version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
15 }
16
17 // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
18 // so check `userAgent` even if `.v8` exists, but 0
19 if (!version && userAgent) {
20   match = userAgent.match(/Edge\/(\d+)/);
21   if (!match || match[1] >= 74) {
22     match = userAgent.match(/Chrome\/(\d+)/);
23     if (match) version = +match[1];
24   }
25 }
26
27 module.exports = version;