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:
877 bytes
|
Line | |
---|
1 | 'use strict';
|
---|
2 | /* global Bun, Deno -- detection */
|
---|
3 | var globalThis = require('../internals/global-this');
|
---|
4 | var userAgent = require('../internals/environment-user-agent');
|
---|
5 | var classof = require('../internals/classof-raw');
|
---|
6 |
|
---|
7 | var userAgentStartsWith = function (string) {
|
---|
8 | return userAgent.slice(0, string.length) === string;
|
---|
9 | };
|
---|
10 |
|
---|
11 | module.exports = (function () {
|
---|
12 | if (userAgentStartsWith('Bun/')) return 'BUN';
|
---|
13 | if (userAgentStartsWith('Cloudflare-Workers')) return 'CLOUDFLARE';
|
---|
14 | if (userAgentStartsWith('Deno/')) return 'DENO';
|
---|
15 | if (userAgentStartsWith('Node.js/')) return 'NODE';
|
---|
16 | if (globalThis.Bun && typeof Bun.version == 'string') return 'BUN';
|
---|
17 | if (globalThis.Deno && typeof Deno.version == 'object') return 'DENO';
|
---|
18 | if (classof(globalThis.process) === 'process') return 'NODE';
|
---|
19 | if (globalThis.window && globalThis.document) return 'BROWSER';
|
---|
20 | return 'REST';
|
---|
21 | })();
|
---|
Note:
See
TracBrowser
for help on using the repository browser.