contentful-sdk-core
Version:
Core modules for the Contentful JS SDKs
31 lines (28 loc) • 903 B
JavaScript
import process from 'process';
function isNode() {
/**
* Polyfills of 'process' might set process.browser === true
*
* See:
* https://github.com/webpack/node-libs-browser/blob/master/mock/process.js#L8
* https://github.com/defunctzombie/node-process/blob/master/browser.js#L156
**/
return typeof process !== 'undefined' && !process.browser;
}
function isReactNative() {
return (typeof window !== 'undefined' &&
'navigator' in window &&
'product' in window.navigator &&
window.navigator.product === 'ReactNative');
}
function getNodeVersion() {
return process.versions && process.versions.node ? `v${process.versions.node}` : process.version;
}
function getWindow() {
return window;
}
function noop() {
return undefined;
}
export { getNodeVersion, getWindow, isNode, isReactNative, noop };
//# sourceMappingURL=utils.js.map