mirror of
https://github.com/graphql-hive/console
synced 2026-04-21 14:37:17 +00:00
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Kamil Kisiela <kamil.kisiela@gmail.com>
19 lines
693 B
TypeScript
19 lines
693 B
TypeScript
import { DeploymentEnvironment } from '../types';
|
|
|
|
export function isProduction(deploymentEnv: DeploymentEnvironment | string): boolean {
|
|
return !isStaging(deploymentEnv);
|
|
}
|
|
|
|
export function isStaging(deploymentEnv: DeploymentEnvironment | string): boolean {
|
|
return isDeploymentEnvironment(deploymentEnv)
|
|
? deploymentEnv.ENVIRONMENT === 'staging'
|
|
: deploymentEnv === 'staging';
|
|
}
|
|
|
|
export function isDeploymentEnvironment(value: any): value is DeploymentEnvironment {
|
|
return value && typeof value === 'object' && typeof value['ENVIRONMENT'] === 'string';
|
|
}
|
|
|
|
export function isDefined<T>(value: T | null | undefined): value is T {
|
|
return value !== null && value !== undefined;
|
|
}
|