Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 10th, 2012  |  syntax: None  |  size: 0.20 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Check if a node.js module is available
  2. var mongodb;
  3. try {
  4.     mongodb = require( 'mongodb' );
  5. }
  6. catch( e ) {
  7.     if ( e.code === 'MODULE_NOT_FOUND' ) {
  8.         // The module hasn't been found
  9.     }
  10. }