Skip to content

Commit c9c724c

Browse files
committed
docs: add jsdoc
1 parent ca6f311 commit c9c724c

4 files changed

Lines changed: 23 additions & 1 deletion

File tree

src/browser.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,10 @@ function save(namespaces: string) {
223223
}
224224
}
225225

226+
/**
227+
* Enables a debug mode by namespaces. This can include modes
228+
* separated by a colon and wildcards.
229+
*/
226230
function enable(namespaces: string): void {
227231
save(namespaces)
228232
_enable(namespaces)

src/core.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ import type { Debugger, DebugOptions } from './types.ts'
33

44
let globalNamespaces: string = ''
55

6+
/**
7+
* Returns a string of the currently enabled debug namespaces.
8+
*/
69
export function namespaces(): string {
710
return globalNamespaces
811
}
@@ -127,6 +130,9 @@ export function enable(namespaces: string): void {
127130
}
128131
}
129132

133+
/**
134+
* Disable debug output.
135+
*/
130136
export function disable(): string {
131137
const namespaces = [
132138
...names,
@@ -136,6 +142,9 @@ export function disable(): string {
136142
return namespaces
137143
}
138144

145+
/**
146+
* Returns true if the given mode name is enabled, false otherwise.
147+
*/
139148
export function enabled(name: string): boolean {
140149
for (const skip of skips) {
141150
if (matchesTemplate(name, skip)) {

src/node.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ function getDate(): string {
8080
/**
8181
* Adds ANSI color escape codes if enabled.
8282
*/
83-
export function formatArgs(
83+
function formatArgs(
8484
this: Debugger,
8585
diff: number,
8686
args: [string, ...any[]],
@@ -153,6 +153,10 @@ function save(namespaces: string): void {
153153
}
154154
}
155155

156+
/**
157+
* Enables a debug mode by namespaces. This can include modes
158+
* separated by a colon and wildcards.
159+
*/
156160
function enable(namespaces: string): void {
157161
save(namespaces)
158162
_enable(namespaces)

src/types.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ export interface InspectOptions extends NodeInspectOptions {
44
hideDate?: boolean
55
}
66

7+
/**
8+
* Map of special "%n" handling functions, for the debug "format" argument.
9+
*
10+
* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
11+
*/
712
export interface Formatters {
813
[formatter: string]: (this: Debugger, v: any) => string
914
}

0 commit comments

Comments
 (0)