path-unified
Version:
Node's path builtin module exposed as dual ESM/CJS and browser-compatible out of the box.
16 lines (15 loc) • 396 B
JavaScript
/**
* @returns {boolean}
*/
export const isWindows = () => {
// browser
if (typeof window === 'object') {
return (
// @ts-expect-error some browsers support userAgentData.platform, not all though...
window.navigator.userAgentData?.platform === 'Windows' ||
window.navigator.userAgent.includes('Windows')
);
}
// node
return process?.platform === 'win32';
};