File tree Expand file tree Collapse file tree 4 files changed +8
-8
lines changed
Expand file tree Collapse file tree 4 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ const colors = [
1212] ;
1313
1414// https://github.com/debug-js/debug/blob/4.3.4/src/common.js#L41
15- export function selectColour ( ns : string ) {
15+ export function selectColour ( ns : string ) : number {
1616 let hash = 0 ;
1717
1818 for ( let i = 0 ; i < ns . length ; i ++ ) {
@@ -23,7 +23,7 @@ export function selectColour(ns: string) {
2323 return colors [ Math . abs ( hash ) % colors . length ] ;
2424}
2525
26- export const colourNs = ( ns : string ) => {
26+ export const colourNs = ( ns : string ) : string => {
2727 const color = selectColour ( ns ) ;
2828 const r = color >> 16 ;
2929 const g = ( color >> 8 ) & 0xff ;
Original file line number Diff line number Diff line change 11import { context } from "./types.ts" ;
22
3- const getDenoEnv = ( variable : string ) => {
3+ const getDenoEnv = ( variable : string ) : string => {
44 const Deno = context . Deno ;
55 const state = Deno ! . permissions . querySync ?.( { name : "env" , variable } ) ?. state ;
66 if ( state === "prompt" ) return "" ;
@@ -9,7 +9,7 @@ const getDenoEnv = (variable: string) => {
99
1010const deno = "Deno" in globalThis ;
1111
12- export const getEnv = ( variable : string ) => {
12+ export const getEnv = ( variable : string ) : string => {
1313 if ( deno ) return getDenoEnv ( variable ) ;
1414 return context . process ?. env [ variable ] || context . env ?. [ variable ] || "" ;
1515} ;
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ export class Namespaces {
77 this . update ( debugspec ) ;
88 }
99
10- update ( debugspec : string ) {
10+ update ( debugspec : string ) : void {
1111 const parsed = this . parsed ;
1212 const debugs = debugspec . split ( / [ \s , ] + / ) . map ( each => each . trim ( ) ) ;
1313 for ( const item of debugs ) {
@@ -28,7 +28,7 @@ export class Namespaces {
2828 this . parsed = parsed ;
2929 }
3030
31- check ( namespace : string ) {
31+ check ( namespace : string ) : boolean {
3232 const chain = namespace . split ( ":" ) . map ( part => part . trim ( ) ) ;
3333 let current = this . parsed ;
3434 let tentative = false ;
Original file line number Diff line number Diff line change @@ -2,12 +2,12 @@ import { context } from "./types.ts";
22import { colourNs , selectColour } from "./colours.ts" ;
33import { getEnv } from "./env.ts" ;
44import { Namespaces } from "./namespacing.ts" ;
5- const DEBUG = getEnv ( "DEBUG" ) ;
5+ const DEBUG : string = getEnv ( "DEBUG" ) ;
66const stderr = context . process ?. stderr ;
77const useColour = stderr ?. isTTY && ! getEnv ( "NO_COLOR" ) ;
88const debug = context . console . Console ?.( stderr ) ?. debug || context . console . debug ;
99
10- export const namespaces = new Namespaces ( DEBUG ) ;
10+ export const namespaces : Namespaces = new Namespaces ( DEBUG ) ;
1111
1212export interface DebugFn {
1313 ( ...args : unknown [ ] ) : void ;
You can’t perform that action at this time.
0 commit comments