All files / src/utilities debug.js

75% Statements 3/4
50% Branches 1/2
100% Functions 2/2
75% Lines 3/4
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39                    31x                           797x               31x            
/**
 * Imports the config module
 * @module config
 */
import config from "../config.js";
 
/**
 * Handles the debugging of AmplitudeJS
 * @module utilities/Debug
 */
let Debug = (function() {
  /**
   * Writes out debug message to the console if enabled.
   *
   * Public Accessor: Debug.writeMessage( message )
   *
   * @access public
   * @param {string} message - The string that gets printed to alert the user of a debugging error.
   */
  function writeMessage(message) {
    /*
      If the user has flagged AmplitudeJS to debug, we print out a message
      to the console.
    */
    Iif (config.debug) {
      console.log(message);
    }
  }
 
  /*
    Returns the public facing methods
  */
  return {
    writeMessage: writeMessage
  };
})();
 
export default Debug;