Simple script to check if you are running on Node.js or on a Browser
1function detectIfItsBrowser() { 2 return typeof window !== 'undefined' && typeof window.document !== 'undefined'; 3}
Created on 3/18/2019