all files / gulp-remove-logging/lib/ removelogging.js

100% Statements 4/4
100% Branches 2/2
100% Functions 1/1
100% Lines 4/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                            36×               36×        
/*
 * gulp-remove-logging
 * Based on ehynds/grunt-remove-logging
 *
 * Copyright 2016, Valerian Saliou
 * Author: Valerian Saliou <valerian@valeriansaliou.name>
 */
 
 
"use strict";
 
 
var gulp_replace  = require("gulp-replace");
 
 
exports.proceed = function(opts) {
  var regex_console = new RegExp(
    ("(" + opts.namespace.join("|") + ")" +
        ".(?:" + opts.methods.join("|") +
        ")\\s{0,}\\([^;]*\\)(?!\\s*[;,]?\\s*\\/\\*\\s*" +
        "RemoveLogging:skip\\s*\\*\\/)\\s{0,};?"),
    "gi"
  );
 
  return gulp_replace(
    regex_console, (opts.replaceWith || "")
  );
};