drapcode-utility 1.7.3 → 1.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -34,3 +34,4 @@ export declare const validateData: (fields: any, data: any) => {
34
34
  errors: any;
35
35
  };
36
36
  export declare const validateUrl: (url: any) => boolean;
37
+ export declare const toggleConsoleLogs: (enable: boolean) => void;
@@ -34,7 +34,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
34
34
  return (mod && mod.__esModule) ? mod : { "default": mod };
35
35
  };
36
36
  Object.defineProperty(exports, "__esModule", { value: true });
37
- exports.validateUrl = exports.validateData = exports.fillDefaultValues = exports.replaceValueFromSource = exports.processFieldsInlcude = exports.removeMongoDbId = exports.replaceTransferObjectValueIntoExpression = exports.unflattenObject = exports.parseValueFromData = exports.parseJsonString = exports.replaceDataValueIntoExpression = exports.formatCustomCSSClasses = exports.validateAlphanumericString = exports.convertItemToArray = exports.arraysEqual = exports.checkAndCompareValue = exports.restructureData = exports.formatCollectionAndFieldName = exports.cleanCollectionAndFieldName = exports.stringToExpression = exports.expressionToString = exports.getSpecialCharectorReplacedExpression = exports.validateUuidString = exports.validateEmail = exports.snakeCaseToTitleCase = exports.dynamicSort = exports.checkValidArray = exports.isObject = exports.isEmptyObject = exports.isEmpty = exports.clearSpaceAndReformat = exports.camelize = exports.validateString = void 0;
37
+ exports.toggleConsoleLogs = exports.validateUrl = exports.validateData = exports.fillDefaultValues = exports.replaceValueFromSource = exports.processFieldsInlcude = exports.removeMongoDbId = exports.replaceTransferObjectValueIntoExpression = exports.unflattenObject = exports.parseValueFromData = exports.parseJsonString = exports.replaceDataValueIntoExpression = exports.formatCustomCSSClasses = exports.validateAlphanumericString = exports.convertItemToArray = exports.arraysEqual = exports.checkAndCompareValue = exports.restructureData = exports.formatCollectionAndFieldName = exports.cleanCollectionAndFieldName = exports.stringToExpression = exports.expressionToString = exports.getSpecialCharectorReplacedExpression = exports.validateUuidString = exports.validateEmail = exports.snakeCaseToTitleCase = exports.dynamicSort = exports.checkValidArray = exports.isObject = exports.isEmptyObject = exports.isEmpty = exports.clearSpaceAndReformat = exports.camelize = exports.validateString = void 0;
38
38
  var drapcode_constant_1 = require("drapcode-constant");
39
39
  var lodash_1 = __importDefault(require("lodash"));
40
40
  var format_fields_1 = require("../format-fields");
@@ -70,6 +70,9 @@ var derivedFieldExcludes = [
70
70
  ];
71
71
  var environmentFixKey = "environment_variable.";
72
72
  var tenantFixKey = "current_tenant.";
73
+ var CONSOLE_LOG_MODIFIED = false;
74
+ var OLD_CONSOLE_LOG = null;
75
+ var OLD_CONSOLE_INFO = null;
73
76
  var validateString = function (str) {
74
77
  var specialChar = /[`!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/;
75
78
  var isNumber = str.match(/\d+/g);
@@ -757,3 +760,24 @@ var validateUrl = function (url) {
757
760
  return !!pattern.test(url);
758
761
  };
759
762
  exports.validateUrl = validateUrl;
763
+ var toggleConsoleLogs = function (enable) {
764
+ if (enable && CONSOLE_LOG_MODIFIED) {
765
+ console.log('==> Enabling console log|info...');
766
+ if (OLD_CONSOLE_LOG && OLD_CONSOLE_INFO) {
767
+ console.log = OLD_CONSOLE_LOG;
768
+ console.info = OLD_CONSOLE_INFO;
769
+ CONSOLE_LOG_MODIFIED = false;
770
+ console.log("==> Enabling Console log modified: ".concat(CONSOLE_LOG_MODIFIED));
771
+ }
772
+ }
773
+ else if (!enable && !CONSOLE_LOG_MODIFIED) {
774
+ OLD_CONSOLE_LOG = console.log;
775
+ OLD_CONSOLE_INFO = console.info;
776
+ console.log('==> Disabling console log|info...');
777
+ console.log = function () { };
778
+ console.info = function () { };
779
+ CONSOLE_LOG_MODIFIED = true;
780
+ console.log("==> Disabling Console log modified: ".concat(CONSOLE_LOG_MODIFIED));
781
+ }
782
+ };
783
+ exports.toggleConsoleLogs = toggleConsoleLogs;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drapcode-utility",
3
- "version": "1.7.3",
3
+ "version": "1.7.4",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",