detectify

0.0.2 • Public • Published

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!"

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.2
    2
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.2
    2
  • 0.0.1
    2

Package Sidebar

Install

npm i detectify

Weekly Downloads

2

Version

0.0.2

License

none

Last publish

Collaborators

  • brec-c