Code coverage report for lib/utils/index.js

Statements: 80% (16 / 20)      Branches: 62.5% (5 / 8)      Functions: 66.67% (6 / 9)      Lines: 80% (16 / 20)     

All files » lib/utils/ » index.js
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 40 41 42 43 44 45 46 47 48 49 50 51 521 1     1             1 1 5         1         3             8 6 5     8             1   1   16     11    
'use strict';
var noop = function () {},
    path = require('path');
 
var utils = module.exports = {
  clone: require('./clone'),
  merge: require('./merge'),
  bus: require('./bus'),
  isWindows: process.platform === 'win32',
  isMac: process.platform === 'darwin',
  isRequired: (function () {
    var p = module;
    while (p = p.parent) {
      Iif (p.filename.indexOf('bin' + path.sep + 'nodemon.js') !== -1) {
        return false;
      }
    }
 
    return true;
  })(),
  home: process.env.HOME || process.env.HOMEPATH,
  quiet: function () {
    // nukes the logging
    Iif (!this.debug) {
      Object.keys(this.log).forEach(function (method) {
        this.log[method] = noop;
      }.bind(this));
    }
  },
  reset: function () {
    if (!this.debug) {
      Object.keys(this.log).forEach(function (method) {
        delete this.log[method];
      }.bind(this));
    }
    this.debug = false;
  },
  regexpToText: function (t) {
    return t.replace(/\.\*\\./g, '*.').replace(/\\{2}/g, '^^').replace(/\\/g, '').replace(/\^\^/g, '\\');
  }
};
 
utils.log = require('./log')(utils.isRequired);
 
Object.defineProperty(utils, 'debug', {
  set: function (value) {
    this.log.debug = value;
  },
  get: function () {
    return this.log.debug;
  }
});