X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Futils%2FUtils.ts;h=f701cea041ab831d1b1ff323123e02c60b69b11b;hb=1185579a331f3484e8ed7882203d2e58466635dd;hp=0271754f1c00b5df6d24b90501cc4b7d4c831ee0;hpb=268a74bb051fcbbad532fd833f0d8fd2b33b6c64;p=e-mobility-charging-stations-simulator.git diff --git a/src/utils/Utils.ts b/src/utils/Utils.ts index 0271754f..f701cea0 100644 --- a/src/utils/Utils.ts +++ b/src/utils/Utils.ts @@ -3,6 +3,7 @@ import util from 'node:util'; import clone from 'just-clone'; +// import { Constants } from './internal'; import { Constants } from './Constants'; import { WebSocketCloseEventStatusString } from '../types'; @@ -185,6 +186,14 @@ export class Utils { return clone(object); } + public static hasOwnProp(object: unknown, property: PropertyKey): boolean { + return Utils.isObject(object) && Object.hasOwn(object as object, property); + } + + public static isCFEnvironment(): boolean { + return process.env.VCAP_APPLICATION !== undefined; + } + public static isIterable(obj: T): boolean { return !Utils.isNullOrUndefined(obj) ? typeof obj[Symbol.iterator] === 'function' : false; }