@letsparky/api-v2-client
Version:
TypeScript client for the LetsParky API V2
39 lines (38 loc) • 1.09 kB
JavaScript
/**
* Simple environment detection utilities
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.Environment = void 0;
exports.Environment = {
isNode: () => {
var _a;
try {
return typeof process !== 'undefined' &&
((_a = process === null || process === void 0 ? void 0 : process.release) === null || _a === void 0 ? void 0 : _a.name) === 'node' &&
typeof navigator === 'undefined';
}
catch {
return false;
}
},
isReactNative: () => {
try {
return typeof navigator === 'object' &&
(navigator === null || navigator === void 0 ? void 0 : navigator.product) === 'ReactNative';
}
catch {
return false;
}
},
isBrowser: () => {
try {
return typeof window !== 'undefined' &&
typeof document !== 'undefined' &&
!exports.Environment.isReactNative();
}
catch {
return false;
}
}
};
;