mirror of
https://github.com/x1xhlol/system-prompts-and-models-of-ai-tools.git
synced 2026-02-04 05:50:50 +00:00
nhj
more
This commit is contained in:
47
unified-ai-platform/node_modules/environment/index.js
generated
vendored
Normal file
47
unified-ai-platform/node_modules/environment/index.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
/* globals WorkerGlobalScope, DedicatedWorkerGlobalScope, SharedWorkerGlobalScope, ServiceWorkerGlobalScope */
|
||||
|
||||
export const isBrowser = globalThis.window?.document !== undefined;
|
||||
|
||||
export const isNode = globalThis.process?.versions?.node !== undefined;
|
||||
|
||||
export const isBun = globalThis.process?.versions?.bun !== undefined;
|
||||
|
||||
export const isDeno = globalThis.Deno?.version?.deno !== undefined;
|
||||
|
||||
export const isElectron = globalThis.process?.versions?.electron !== undefined;
|
||||
|
||||
export const isJsDom = globalThis.navigator?.userAgent?.includes('jsdom') === true;
|
||||
|
||||
export const isWebWorker = typeof WorkerGlobalScope !== 'undefined' && globalThis instanceof WorkerGlobalScope;
|
||||
|
||||
export const isDedicatedWorker = typeof DedicatedWorkerGlobalScope !== 'undefined' && globalThis instanceof DedicatedWorkerGlobalScope;
|
||||
|
||||
export const isSharedWorker = typeof SharedWorkerGlobalScope !== 'undefined' && globalThis instanceof SharedWorkerGlobalScope;
|
||||
|
||||
export const isServiceWorker = typeof ServiceWorkerGlobalScope !== 'undefined' && globalThis instanceof ServiceWorkerGlobalScope;
|
||||
|
||||
// Note: I'm intentionally not DRYing up the other variables to keep them "lazy".
|
||||
const platform = globalThis.navigator?.userAgentData?.platform;
|
||||
|
||||
export const isMacOs = platform === 'macOS'
|
||||
|| globalThis.navigator?.platform === 'MacIntel' // Even on Apple silicon Macs.
|
||||
|| globalThis.navigator?.userAgent?.includes(' Mac ') === true
|
||||
|| globalThis.process?.platform === 'darwin';
|
||||
|
||||
export const isWindows = platform === 'Windows'
|
||||
|| globalThis.navigator?.platform === 'Win32'
|
||||
|| globalThis.process?.platform === 'win32';
|
||||
|
||||
export const isLinux = platform === 'Linux'
|
||||
|| globalThis.navigator?.platform?.startsWith('Linux') === true
|
||||
|| globalThis.navigator?.userAgent?.includes(' Linux ') === true
|
||||
|| globalThis.process?.platform === 'linux';
|
||||
|
||||
export const isIos = platform === 'iOS'
|
||||
|| (globalThis.navigator?.platform === 'MacIntel' && globalThis.navigator?.maxTouchPoints > 1)
|
||||
|| /iPad|iPhone|iPod/.test(globalThis.navigator?.platform);
|
||||
|
||||
export const isAndroid = platform === 'Android'
|
||||
|| globalThis.navigator?.platform === 'Android'
|
||||
|| globalThis.navigator?.userAgent?.includes(' Android ') === true
|
||||
|| globalThis.process?.platform === 'android';
|
||||
9
unified-ai-platform/node_modules/environment/license
generated
vendored
Normal file
9
unified-ai-platform/node_modules/environment/license
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
74
unified-ai-platform/node_modules/environment/package.json
generated
vendored
Normal file
74
unified-ai-platform/node_modules/environment/package.json
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
{
|
||||
"name": "environment",
|
||||
"version": "1.1.0",
|
||||
"description": "Check which JavaScript environment your code is running in at runtime: browser, Node.js, Bun, etc",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/environment",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"type": "module",
|
||||
"exports": {
|
||||
"types": "./index.d.ts",
|
||||
"default": "./index.js"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsc index.d.ts"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"runtime",
|
||||
"environment",
|
||||
"env",
|
||||
"execution",
|
||||
"engine",
|
||||
"platform",
|
||||
"context",
|
||||
"js",
|
||||
"javascript",
|
||||
"is",
|
||||
"check",
|
||||
"checking",
|
||||
"detect",
|
||||
"detection",
|
||||
"browser",
|
||||
"node",
|
||||
"bun",
|
||||
"deno",
|
||||
"electron",
|
||||
"jsdom",
|
||||
"webworker",
|
||||
"worker",
|
||||
"serviceworker",
|
||||
"macos",
|
||||
"ios",
|
||||
"iphone",
|
||||
"ipad",
|
||||
"windows",
|
||||
"linux",
|
||||
"android",
|
||||
"os",
|
||||
"operating",
|
||||
"system"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "^6.1.3",
|
||||
"typescript": "^5.4.5",
|
||||
"xo": "^0.58.0"
|
||||
},
|
||||
"xo": {
|
||||
"rules": {
|
||||
"n/prefer-global/process": "off"
|
||||
}
|
||||
}
|
||||
}
|
||||
94
unified-ai-platform/node_modules/environment/readme.md
generated
vendored
Normal file
94
unified-ai-platform/node_modules/environment/readme.md
generated
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
# environment
|
||||
|
||||
> Check which JavaScript environment your code is running in at runtime
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
npm install environment
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import {isBrowser, isNode} from 'environment';
|
||||
|
||||
if (isBrowser) {
|
||||
console.log('Running in a browser!');
|
||||
}
|
||||
|
||||
if (isNode) {
|
||||
console.log('Running in Node.js!');
|
||||
}
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
> Runtime checks should be used sparingly. Prefer [conditional package exports](https://nodejs.org/api/packages.html#conditional-exports) and [imports](https://nodejs.org/api/packages.html#subpath-imports) whenever possible.
|
||||
|
||||
## API
|
||||
|
||||
### `isBrowser`
|
||||
|
||||
Check if the code is running in a web browser environment.
|
||||
|
||||
### `isNode`
|
||||
|
||||
Check if the code is running in a [Node.js](https://nodejs.org) environment.
|
||||
|
||||
### `isBun`
|
||||
|
||||
Check if the code is running in a [Bun](https://bun.sh) environment.
|
||||
|
||||
### `isDeno`
|
||||
|
||||
Check if the code is running in a [Deno](https://deno.com) environment.
|
||||
|
||||
### `isElectron`
|
||||
|
||||
Check if the code is running in an [Electron](https://www.electronjs.org) environment.
|
||||
|
||||
### `isJsDom`
|
||||
|
||||
Check if the code is running in a [jsdom](https://github.com/jsdom/jsdom) environment.
|
||||
|
||||
### `isWebWorker`
|
||||
|
||||
Check if the code is running in a [Web Worker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API#worker_global_contexts_and_functions) environment, which could be either a dedicated worker, shared worker, or service worker.
|
||||
|
||||
### `isDedicatedWorker`
|
||||
|
||||
Check if the code is running in a [Dedicated Worker](https://developer.mozilla.org/en-US/docs/Web/API/DedicatedWorkerGlobalScope) environment.
|
||||
|
||||
### `isSharedWorker`
|
||||
|
||||
Check if the code is running in a [Shared Worker](https://developer.mozilla.org/en-US/docs/Web/API/SharedWorkerGlobalScope) environment.
|
||||
|
||||
### `isServiceWorker`
|
||||
|
||||
Check if the code is running in a [Service Worker](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerGlobalScope) environment.
|
||||
|
||||
### `isMacOs`
|
||||
|
||||
Check if the code is running on macOS.
|
||||
|
||||
### `isWindows`
|
||||
|
||||
Check if the code is running on Windows.
|
||||
|
||||
### `isLinux`
|
||||
|
||||
Check if the code is running on Linux.
|
||||
|
||||
### `isIos`
|
||||
|
||||
Check if the code is running on iOS.
|
||||
|
||||
### `isAndroid`
|
||||
|
||||
Check if the code is running on Android.
|
||||
|
||||
## Related
|
||||
|
||||
- [is-in-ci](https://github.com/sindresorhus/is-in-ci) - Check if the process is running in a CI environment
|
||||
- [is64bit](https://github.com/sindresorhus/is64bit) - Check if the operating system CPU architecture is 64-bit or 32-bit
|
||||
- [is](https://github.com/sindresorhus/is) - Type check values
|
||||
Reference in New Issue
Block a user