@ianwremmel/debug
v1.1.3
Published
Simplified naming for 'debug'
Downloads
322
Readme
@ianwremmel/debug
Simplified naming for 'debug'
Table of Contents
Install
npm install @ianwremmel/debug
Usage
This package exports three helpers for making it easier to use the debug
package.
debug
debug()
wraps debug()
from the debug package and accepts a string. That
strings should be __filename
. It first starts with your package name, then it
uses the relative path from your package.json
to the current file to setup a
debug namespace, replacing /
with :
.
import {debug} from '@ianwremmel/debug';
const d = debug(__filename);
d('Something happened');
format
format
is a template string tag that colorizes your variable substitutions. It
doesn't need to be used with debug()
but it does make debug()
's output
easier to read (or, at least more entertaining).
import {debug, format as f} from '@ianwremmel/debug';
const d = debug(__filename);
d(f`${5} is a number`);
d(f`${true} is a boolean`);
df
df()
is factory that produces a template string tag that combines debug()
and format
.
import {df} from '@ianwremmel/debug';
const d = df(__filename);
d`${5} is a number`;
d`${true} is a boolean`;
Maintainer
Contribute
PRs Welcome
License
MIT © Ian Remmel 2018 until at least now