You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
877 B
22 lines
877 B
'use strict';
|
|
/* global Bun, Deno -- detection */
|
|
var globalThis = require('../internals/global-this');
|
|
var userAgent = require('../internals/environment-user-agent');
|
|
var classof = require('../internals/classof-raw');
|
|
|
|
var userAgentStartsWith = function (string) {
|
|
return userAgent.slice(0, string.length) === string;
|
|
};
|
|
|
|
module.exports = (function () {
|
|
if (userAgentStartsWith('Bun/')) return 'BUN';
|
|
if (userAgentStartsWith('Cloudflare-Workers')) return 'CLOUDFLARE';
|
|
if (userAgentStartsWith('Deno/')) return 'DENO';
|
|
if (userAgentStartsWith('Node.js/')) return 'NODE';
|
|
if (globalThis.Bun && typeof Bun.version == 'string') return 'BUN';
|
|
if (globalThis.Deno && typeof Deno.version == 'object') return 'DENO';
|
|
if (classof(globalThis.process) === 'process') return 'NODE';
|
|
if (globalThis.window && globalThis.document) return 'BROWSER';
|
|
return 'REST';
|
|
})();
|