Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

achorn

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

achorn - npm Package Compare versions

Comparing version 0.3.2 to 0.3.3

2

lib/achorn.js

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

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("Achorn",[],e):"object"==typeof exports?exports.Achorn=e():t.Achorn=e()}(window,(function(){return function(t){var e={};function o(r){if(e[r])return e[r].exports;var n=e[r]={i:r,l:!1,exports:{}};return t[r].call(n.exports,n,n.exports,o),n.l=!0,n.exports}return o.m=t,o.c=e,o.d=function(t,e,r){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)o.d(r,n,function(e){return t[e]}.bind(null,n));return r},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=0)}([function(t,e,o){"use strict";var r=this&&this.__spreadArrays||function(){for(var t=0,e=0,o=arguments.length;e<o;e++)t+=arguments[e].length;var r=Array(t),n=0;for(e=0;e<o;e++)for(var s=arguments[e],i=0,l=s.length;i<l;i++,n++)r[n]=s[i];return r};Object.defineProperty(e,"__esModule",{value:!0});var n=o(1),s=function(){function t(t){var e=this;this.globalConfig={},this.config(t||{}),n.prefixes.concat(t&&t.prefixes||[]).map((function(t){t.keys.map((function(t){e[t]=function(){for(var o=[],r=0;r<arguments.length;r++)o[r]=arguments[r];e.consoleLog(t,o)}}))}))}return Object.defineProperty(t.prototype,"longestPrefixLength",{get:function(){return n.prefixes.map((function(t){return t.parts[1].string})).reduce((function(t,e){return t.length>e.length?t:e})).length},enumerable:!1,configurable:!0}),t.prototype.config=function(t){this.globalConfig=t},t.prototype.joinParts=function(t,e){var o=""+" ".repeat(e||0),r=[];return t.map((function(t){o+="%c"+t.string,r.push(t.style)})),[o].concat(r)},t.prototype.calcAdditionalWhitespace=function(t){var e=t[1].string.length,o=this.longestPrefixLength-e+1;return o<0?0:o},t.prototype.consoleLog=function(t,e){var o=n.prefixes.find((function(e){return e.keys.includes(t)}))||n.prefixes.find((function(t){return t.keys.includes("info")})),s=[].concat(o.parts);switch(s.push({string:" ".repeat(this.calcAdditionalWhitespace(s)),style:"color: unset;"}),this.globalConfig.showTimestamp&&s.unshift({string:"["+(new Date).getHours()+":"+(new Date).getMinutes()+":"+(new Date).getSeconds()+"] ",style:"color: unset;"}),this.globalConfig.globalPrefix&&(s=this.globalConfig.globalPrefix.concat(s)),o.logType){case"warn":return void console.warn.apply(console,r(this.joinParts(s,1),e.length>0?e:[e[0]]));case"error":return void console.error.apply(console,r(this.joinParts(s,1),e.length>0?e:[e[0]]));default:console.log.apply(console,r(this.joinParts(s,2),e.length>0?e:[e[0]]))}},t.prototype.timer=function(t){return new i("string"==typeof t?{key:t}:t)},t.prototype.silentTimer=function(t){return new i("string"==typeof t?{key:t,silent:!0}:t)},t}();e.default=s;var i=function(){function t(t){this.achorn=new s,this.options=t,this.start()}return t.prototype.start=function(){this.startTime=+new Date;var t=[{string:"‣ ",style:"color: #2EB6CB;"},{string:this.options.key?this.options.key:"timer",style:"color: #2EB6CB; font-weight: bold;"}];t.push({string:" ".repeat(this.achorn.calcAdditionalWhitespace(t)),style:"color: unset;"}),this.options.silent||console.log.apply(console,r(this.achorn.joinParts(t,2),["Timer started"]))},t.prototype.end=function(){this.endTime=+new Date,this.duration=this.endTime-this.startTime;var t=[{string:"‣ ",style:"color: #2EB6CB;"},{string:this.options.key?this.options.key:"timer",style:"color: #2EB6CB; font-weight: bold;"}];t.push({string:" ".repeat(this.achorn.calcAdditionalWhitespace(t)),style:"color: unset;"}),console.log.apply(console,r(this.achorn.joinParts(t,2),["Timer ended after "+this.duration+"ms"]))},t.prototype.success=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.endTime=+new Date,this.duration=this.endTime-this.startTime;var o=[{string:"✔️ ",style:"color: #7EB507;"},{string:this.options.key?this.options.key:"success",style:"color: #7EB507; font-weight: bold;"}];o.push({string:" ".repeat(this.achorn.calcAdditionalWhitespace(o)),style:"color: unset;"}),console.log.apply(console,r(this.achorn.joinParts(o,2),t&&t.length>0?t.concat(["("+this.duration+"ms)"]):["Timer succeeded after "+this.duration+"ms"]))},t.prototype.error=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.endTime=+new Date,this.duration=this.endTime-this.startTime;var o=[{string:"× ",style:"color: #FF312D;"},{string:this.options.key?this.options.key:"aborted",style:"color: #FF312D; font-weight: bold;"}];o.push({string:" ".repeat(this.achorn.calcAdditionalWhitespace(o)),style:"color: unset;"}),console.error.apply(console,r(this.achorn.joinParts(o,1),t&&t.length>0?t.concat(["("+this.duration+"ms)"]):["Timer errored after "+this.duration+"ms"]))},t.prototype.abort=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.endTime=+new Date,this.duration=this.endTime-this.startTime;var o=[{string:"⚠️ ",style:"color: #DBA02A;"},{string:this.options.key?this.options.key:"error",style:"color: #DBA02A; font-weight: bold;"}];o.push({string:" ".repeat(this.achorn.calcAdditionalWhitespace(o)),style:"color: unset;"}),console.warn.apply(console,r(this.achorn.joinParts(o,1),t&&t.length>0?t.concat(["("+this.duration+"ms)"]):["Timer aborted after "+this.duration+"ms"]))},t}()},function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.prefixes=void 0,e.prefixes=[{keys:["success"],parts:[{string:"✔️ ",style:"color: #7EB507;"},{string:"success",style:"color: #7EB507; font-weight: bold;"}]},{keys:["error"],logType:"error",parts:[{string:"× ",style:"color: #FF312D;"},{string:"error",style:"color: #FF312D; font-weight: bold;"}]},{keys:["warn","warning"],logType:"warn",parts:[{string:"⚠️ ",style:"color: #DBA02A;"},{string:"warning",style:"color: #DBA02A; font-weight: bold;"}]},{keys:["await","awaiting"],parts:[{string:"… ",style:"color: #2EB6CB;"},{string:"awaiting",style:"color: #2EB6CB; font-weight: bold;"}]},{keys:["start"],parts:[{string:"► ",style:"color: #7EB507;"},{string:"start",style:"color: #7EB507; font-weight: bold;"}]},{keys:["pause"],parts:[{string:"‖ ",style:"color: #DBA02A;"},{string:"pause",style:"color: #DBA02A; font-weight: bold;"}]},{keys:["debug"],parts:[{string:"● ",style:"color: #2EB6CB;"},{string:"debug",style:"color: #2EB6CB; font-weight: bold;"}]},{keys:["info"],parts:[{string:"i ",style:"color: #2EB6CB;"},{string:"info",style:"color: #2EB6CB; font-weight: bold;"}]},{keys:["fatal"],logType:"error",parts:[{string:"◆ ",style:"color: #FF312D;"},{string:"fatal",style:"color: #FF312D; font-weight: bold;"}]},{keys:["timerStart"],parts:[{string:"‣ ",style:"color: #2EB6CB;"},{string:"timer",style:"color: #2EB6CB; font-weight: bold;"}]}]}]).default}));
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("Achorn",[],e):"object"==typeof exports?exports.Achorn=e():t.Achorn=e()}(window,(function(){return function(t){var e={};function o(r){if(e[r])return e[r].exports;var n=e[r]={i:r,l:!1,exports:{}};return t[r].call(n.exports,n,n.exports,o),n.l=!0,n.exports}return o.m=t,o.c=e,o.d=function(t,e,r){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)o.d(r,n,function(e){return t[e]}.bind(null,n));return r},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=0)}([function(t,e,o){"use strict";var r=this&&this.__spreadArrays||function(){for(var t=0,e=0,o=arguments.length;e<o;e++)t+=arguments[e].length;var r=Array(t),n=0;for(e=0;e<o;e++)for(var s=arguments[e],i=0,l=s.length;i<l;i++,n++)r[n]=s[i];return r};Object.defineProperty(e,"__esModule",{value:!0});var n=o(1),s=function(){function t(e){var o=this;this.globalConfig={},this.config(e||{}),n.prefixes.concat(e&&e.prefixes||[]).map((function(e){e.keys.map((function(e){t.prototype[e]=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];o.consoleLog(e,t)}}))}))}return Object.defineProperty(t.prototype,"longestPrefixLength",{get:function(){return n.prefixes.map((function(t){return t.parts[1].string})).reduce((function(t,e){return t.length>e.length?t:e})).length},enumerable:!1,configurable:!0}),t.prototype.config=function(t){this.globalConfig=t},t.prototype.joinParts=function(t,e){var o=""+" ".repeat(e||0),r=[];return t.map((function(t){o+="%c"+t.string,r.push(t.style)})),[o].concat(r)},t.prototype.calcAdditionalWhitespace=function(t){var e=t[1].string.length,o=this.longestPrefixLength-e+1;return o<0?0:o},t.prototype.consoleLog=function(t,e){var o=n.prefixes.find((function(e){return e.keys.includes(t)}))||n.prefixes.find((function(t){return t.keys.includes("info")})),s=[].concat(o.parts);switch(s.push({string:" ".repeat(this.calcAdditionalWhitespace(s)),style:"color: unset;"}),this.globalConfig.showTimestamp&&s.unshift({string:"["+(new Date).getHours()+":"+(new Date).getMinutes()+":"+(new Date).getSeconds()+"] ",style:"color: unset;"}),this.globalConfig.globalPrefix&&(s=this.globalConfig.globalPrefix.concat(s)),o.logType){case"warn":return void console.warn.apply(console,r(this.joinParts(s,1),e.length>0?e:[e[0]]));case"error":return void console.error.apply(console,r(this.joinParts(s,1),e.length>0?e:[e[0]]));default:console.log.apply(console,r(this.joinParts(s,2),e.length>0?e:[e[0]]))}},t.prototype.timer=function(t){return new i("string"==typeof t?{key:t}:t)},t.prototype.silentTimer=function(t){return new i("string"==typeof t?{key:t,silent:!0}:t)},t}();e.default=s;var i=function(){function t(t){this.achorn=new s,this.options=t,this.start()}return t.prototype.start=function(){this.startTime=+new Date;var t=[{string:"‣ ",style:"color: #2EB6CB;"},{string:this.options.key?this.options.key:"timer",style:"color: #2EB6CB; font-weight: bold;"}];t.push({string:" ".repeat(this.achorn.calcAdditionalWhitespace(t)),style:"color: unset;"}),this.options.silent||console.log.apply(console,r(this.achorn.joinParts(t,2),["Timer started"]))},t.prototype.end=function(){this.endTime=+new Date,this.duration=this.endTime-this.startTime;var t=[{string:"‣ ",style:"color: #2EB6CB;"},{string:this.options.key?this.options.key:"timer",style:"color: #2EB6CB; font-weight: bold;"}];t.push({string:" ".repeat(this.achorn.calcAdditionalWhitespace(t)),style:"color: unset;"}),console.log.apply(console,r(this.achorn.joinParts(t,2),["Timer ended after "+this.duration+"ms"]))},t.prototype.success=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.endTime=+new Date,this.duration=this.endTime-this.startTime;var o=[{string:"✔️ ",style:"color: #7EB507;"},{string:this.options.key?this.options.key:"success",style:"color: #7EB507; font-weight: bold;"}];o.push({string:" ".repeat(this.achorn.calcAdditionalWhitespace(o)),style:"color: unset;"}),console.log.apply(console,r(this.achorn.joinParts(o,2),t&&t.length>0?t.concat(["("+this.duration+"ms)"]):["Timer succeeded after "+this.duration+"ms"]))},t.prototype.error=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.endTime=+new Date,this.duration=this.endTime-this.startTime;var o=[{string:"× ",style:"color: #FF312D;"},{string:this.options.key?this.options.key:"aborted",style:"color: #FF312D; font-weight: bold;"}];o.push({string:" ".repeat(this.achorn.calcAdditionalWhitespace(o)),style:"color: unset;"}),console.error.apply(console,r(this.achorn.joinParts(o,1),t&&t.length>0?t.concat(["("+this.duration+"ms)"]):["Timer errored after "+this.duration+"ms"]))},t.prototype.abort=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.endTime=+new Date,this.duration=this.endTime-this.startTime;var o=[{string:"⚠️ ",style:"color: #DBA02A;"},{string:this.options.key?this.options.key:"error",style:"color: #DBA02A; font-weight: bold;"}];o.push({string:" ".repeat(this.achorn.calcAdditionalWhitespace(o)),style:"color: unset;"}),console.warn.apply(console,r(this.achorn.joinParts(o,1),t&&t.length>0?t.concat(["("+this.duration+"ms)"]):["Timer aborted after "+this.duration+"ms"]))},t}()},function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.prefixes=void 0,e.prefixes=[{keys:["success"],parts:[{string:"✔️ ",style:"color: #7EB507;"},{string:"success",style:"color: #7EB507; font-weight: bold;"}]},{keys:["error"],logType:"error",parts:[{string:"× ",style:"color: #FF312D;"},{string:"error",style:"color: #FF312D; font-weight: bold;"}]},{keys:["warn","warning"],logType:"warn",parts:[{string:"⚠️ ",style:"color: #DBA02A;"},{string:"warning",style:"color: #DBA02A; font-weight: bold;"}]},{keys:["await","awaiting"],parts:[{string:"… ",style:"color: #2EB6CB;"},{string:"awaiting",style:"color: #2EB6CB; font-weight: bold;"}]},{keys:["start"],parts:[{string:"► ",style:"color: #7EB507;"},{string:"start",style:"color: #7EB507; font-weight: bold;"}]},{keys:["pause"],parts:[{string:"‖ ",style:"color: #DBA02A;"},{string:"pause",style:"color: #DBA02A; font-weight: bold;"}]},{keys:["debug"],parts:[{string:"● ",style:"color: #2EB6CB;"},{string:"debug",style:"color: #2EB6CB; font-weight: bold;"}]},{keys:["info"],parts:[{string:"i ",style:"color: #2EB6CB;"},{string:"info",style:"color: #2EB6CB; font-weight: bold;"}]},{keys:["fatal"],logType:"error",parts:[{string:"◆ ",style:"color: #FF312D;"},{string:"fatal",style:"color: #FF312D; font-weight: bold;"}]},{keys:["timerStart"],parts:[{string:"‣ ",style:"color: #2EB6CB;"},{string:"timer",style:"color: #2EB6CB; font-weight: bold;"}]}]}]).default}));
//# sourceMappingURL=achorn.js.map
{
"name": "achorn",
"version": "0.3.2",
"version": "0.3.3",
"description": "🌰 A colourful, good looking, fully customisable logger for the browser",

@@ -5,0 +5,0 @@ "publishConfig": {

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