New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

argon-logger

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

argon-logger - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

26

dist/js/argonLogger.js

@@ -5,3 +5,3 @@ /**!

* @author Sachin Singh <contactsachinsingh@gmail.com>
* @version v0.0.6
* @version v0.0.7
* @license MIT

@@ -138,3 +138,4 @@ */

disable: false,
allowedQueryStringParameters: ['debug']
allowedQueryStringParameters: ['debug'],
allowedPorts: []
}, config));

@@ -157,2 +158,21 @@ this.location = typeof window === 'undefined' ? {} : window.location;

/**
* Checks if given port is allowed
* @param {string} port Current port
* @param {object} config Configuration
*/
function matchesPort(port, config) {
var allowedPorts = Array.isArray(config.allowedPorts) ? config.allowedPorts : [];
allowedPorts = allowedPorts.map(function (port) {
return "".concat(port).trim();
});
if (allowedPorts.length === 0) {
return true;
}
return allowedPorts.indexOf(port) > -1;
}
/**
* Returns a map of query string key value pairs

@@ -234,3 +254,3 @@ * @param {string} queryString Current query string

Logger.prototype[prop] = function () {
if ((matchesURL(this.location.hostname, this.config) || matchesQueryParam(this.location.search, this.config)) && !this.config.disable) {
if ((matchesURL(this.location.hostname, this.config) || matchesQueryParam(this.location.search, this.config)) && matchesPort(this.location.port, this.config) && !this.config.disable) {
var _console;

@@ -237,0 +257,0 @@

2

dist/js/argonLogger.min.js

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Logger=e()}(this,(function(){"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function r(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function o(t){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{};e%2?r(o,!0).forEach((function(e){n(t,e,o[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):r(o).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}function i(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if(!(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t)))return;var n=[],r=!0,o=!1,i=void 0;try{for(var c,a=t[Symbol.iterator]();!(r=(c=a.next()).done)&&(n.push(c.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{r||null==a.return||a.return()}finally{if(o)throw i}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var c=function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e(this,t),this.config=Object.freeze(o({allowedHostnames:["localhost","127.0.0.1","0.0.0.0"],disable:!1,allowedQueryStringParameters:["debug"]},n)),this.location="undefined"==typeof window?{}:window.location,this.URL=this.location.href};function a(t,e){var n=Array.isArray(e.allowedHostnames)?e.allowedHostnames:[];return 0===n.length||!!n.filter((function(e){return e.indexOf(t)>-1})).length}function u(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function l(e,n){var r=Array.isArray(n.allowedQueryStringParameters)?n.allowedQueryStringParameters:[],o=function(t){return(t=t.substring("?"===t.charAt(0)?1:0)).split("&").map((function(t){var e=i(t.split("=").map((function(t){return decodeURIComponent(t).trim()})),2);return{key:e[0],value:e[1]}}))}(e),c=[];r.forEach((function(e){if("string"==typeof e){var n=i(e.split("="),2),r=n[0],o=n[1],a=void 0===o||o;c.push({key:r,value:a})}else e&&"object"===t(e)&&u(e,"key")&&u(e,"value")&&(e.key=e.key.trim(),e.value="".concat(e.value).trim(),c.push(e))}));var a=!1;return c.forEach((function(t){var e=!!o.filter((function(e){return t.key===e.key&&(t.value===e.value||!0===t.value)})).length;a=a||e})),a}return"undefined"!=typeof console&&Object.keys(console).forEach((function(t){"function"==typeof console[t]?c.prototype[t]=function(){var e;!a(this.location.hostname,this.config)&&!l(this.location.search,this.config)||this.config.disable||(e=console)[t].apply(e,arguments)}:c.prototype[t]=console[t]})),c}));
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Logger=e()}(this,(function(){"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function n(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function o(t){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{};e%2?n(o,!0).forEach((function(e){r(t,e,o[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):n(o).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}function i(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if(!(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t)))return;var r=[],n=!0,o=!1,i=void 0;try{for(var a,c=t[Symbol.iterator]();!(n=(a=c.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{n||null==c.return||c.return()}finally{if(o)throw i}}return r}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var a=function t(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e(this,t),this.config=Object.freeze(o({allowedHostnames:["localhost","127.0.0.1","0.0.0.0"],disable:!1,allowedQueryStringParameters:["debug"],allowedPorts:[]},r)),this.location="undefined"==typeof window?{}:window.location,this.URL=this.location.href};function c(t,e){var r=Array.isArray(e.allowedHostnames)?e.allowedHostnames:[];return 0===r.length||!!r.filter((function(e){return e.indexOf(t)>-1})).length}function l(t,e){var r=Array.isArray(e.allowedPorts)?e.allowedPorts:[];return 0===(r=r.map((function(t){return"".concat(t).trim()}))).length||r.indexOf(t)>-1}function u(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function f(e,r){var n=Array.isArray(r.allowedQueryStringParameters)?r.allowedQueryStringParameters:[],o=function(t){return(t=t.substring("?"===t.charAt(0)?1:0)).split("&").map((function(t){var e=i(t.split("=").map((function(t){return decodeURIComponent(t).trim()})),2);return{key:e[0],value:e[1]}}))}(e),a=[];n.forEach((function(e){if("string"==typeof e){var r=i(e.split("="),2),n=r[0],o=r[1],c=void 0===o||o;a.push({key:n,value:c})}else e&&"object"===t(e)&&u(e,"key")&&u(e,"value")&&(e.key=e.key.trim(),e.value="".concat(e.value).trim(),a.push(e))}));var c=!1;return a.forEach((function(t){var e=!!o.filter((function(e){return t.key===e.key&&(t.value===e.value||!0===t.value)})).length;c=c||e})),c}return"undefined"!=typeof console&&Object.keys(console).forEach((function(t){"function"==typeof console[t]?a.prototype[t]=function(){var e;(c(this.location.hostname,this.config)||f(this.location.search,this.config))&&l(this.location.port,this.config)&&!this.config.disable&&(e=console)[t].apply(e,arguments)}:a.prototype[t]=console[t]})),a}));
{
"name": "argon-logger",
"version": "0.0.6",
"version": "0.0.7",
"description": "A simple console logging utility",

@@ -5,0 +5,0 @@ "main": "dist/js/argonLogger",

@@ -11,2 +11,3 @@ /**

allowedQueryStringParameters: ['debug'],
allowedPorts: [],
...config

@@ -33,2 +34,16 @@ });

/**
* Checks if given port is allowed
* @param {string} port Current port
* @param {object} config Configuration
*/
function matchesPort(port, config) {
let allowedPorts = Array.isArray(config.allowedPorts) ? config.allowedPorts : [];
allowedPorts = allowedPorts.map(port => (`${port}`).trim());
if (allowedPorts.length === 0) {
return true;
}
return (allowedPorts.indexOf(port) > -1);
}
/**
* Returns a map of query string key value pairs

@@ -95,3 +110,7 @@ * @param {string} queryString Current query string

if (
(matchesURL(this.location.hostname, this.config) || matchesQueryParam(this.location.search, this.config))
(
matchesURL(this.location.hostname, this.config)
|| matchesQueryParam(this.location.search, this.config)
)
&& matchesPort(this.location.port, this.config)
&& !this.config.disable

@@ -98,0 +117,0 @@ ) {

@@ -10,3 +10,4 @@ declare class Logger extends Console {

allowedHostnames?: string[]
allowedQueryStringParameters?: string[]
allowedQueryStringParameters?: string[],
allowedPorts?: string[],
disable?: boolean

@@ -13,0 +14,0 @@ }

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc