django-vue3-admin-web/node_modules/aws-crt/lib/common/platform.ts
2025-10-20 21:21:14 +08:00

62 lines
1.1 KiB
TypeScript

/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
/**
*
* A module containing miscellaneous platform-related queries
*
* @packageDocumentation
* @module platform
* @mergeTarget
*/
/**
* Returns true if this script is running under nodejs
*
* @category System
*/
export function is_nodejs() {
return (typeof process === 'object' &&
typeof process.versions === 'object' &&
typeof process.versions.node !== 'undefined');
}
/**
* Returns true if this script is running in a browser
*
* @category System
*/
export function is_browser() {
return !is_nodejs();
}
/**
* Returns the package information for aws-crt-nodejs
*
* @category System
*/
export function package_info() {
try {
const pkg = require('../../package.json');
return pkg;
}
catch (err) {
return {
name: 'aws-crt-nodejs',
version: 'UNKNOWN'
};
}
}
/**
* Returns the AWS CRT version
*
* @category System
*/
export function crt_version() {
const pkg = package_info();
return pkg.version;
}