Skip to content

Commit

Permalink
perf: ⚡️ dropping debug library to reduce bundle size
Browse files Browse the repository at this point in the history
  • Loading branch information
davidkelley committed Mar 27, 2020
1 parent b3b8e74 commit 3ebe909
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lib/client/utils.js
@@ -1,9 +1,16 @@
const debug = require('debug');

const PACKAGE_NAME = 'firstclasspostcodes';

module.exports = {
debug: debug(PACKAGE_NAME),
debugging: false,

debug(message, ...args) {
if (this.debugging) {
const style = 'background: black; color: white;';
// eslint-disable-next-line no-console
console.log(`%c${PACKAGE_NAME}:%c ${message}`, style, 'inherit', ...args);
}
return this.debugging;
},

on(eventName, handler) {
const { $handlers = {} } = this;
Expand Down

0 comments on commit 3ebe909

Please sign in to comment.