console/deployment/utils/helpers.ts
Kamil Kisiela 20e3129caa
$ prettier <all> (#46)
Co-authored-by: Dimitri POSTOLOV <dmytropostolov@gmail.com>
2022-05-24 16:31:53 +03:00

17 lines
685 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;
}