Skip to content

Simple module to Detect if you are running in NodeJS environment or a Browser.

License

Notifications You must be signed in to change notification settings

brec-c/detectify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#Detectify

Laughably simple module to test if the current environment is NodeJS or a Browser. This could be expanded upon in the future to include addition environment details, such as: NodeJS version, Browser agent-type, version, etc...

#Installation Using npm
npm install detectify

#Usage

Detectify currently returns an object with 3 properties: hasDetermined, isNodeJS, and isBrowser. All of these are booleans. To use, simply:

detection = require 'detectify'

unless detection.hasDetermined
	throw new Error "Can't continue.  Couldn't detect." 

if detection.isBrowser
	console.log "We're in a browser."
else
	console.log "We're in NodeJS.  Yay!"

About

Simple module to Detect if you are running in NodeJS environment or a Browser.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published