Comparing version 0.1.1 to 0.2.0
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.level = void 0; | ||
exports.Debux = exports.level = void 0; | ||
const chalk_1 = __importDefault(require("chalk")); | ||
@@ -22,3 +22,8 @@ var level; | ||
}; | ||
module.exports = class Debux { | ||
let existing = null; | ||
module.exports = function (options) { | ||
const debux = existing ? existing : (existing = new Debux(options)); | ||
return debux; | ||
}; | ||
class Debux { | ||
constructor(options) { | ||
@@ -75,2 +80,3 @@ this.maxCacheSize = options?.maxCacheSize ?? defaultOptions.maxCacheSize; | ||
} | ||
}; | ||
} | ||
exports.Debux = Debux; |
@@ -8,3 +8,3 @@ "use strict"; | ||
const __1 = __importDefault(require("..")); | ||
const debug = new __1.default({ maxCacheSize: 10, logLevel: 4 }); | ||
const debug = __1.default({ maxCacheSize: 10, logLevel: 4 }); | ||
debug.log(null, { | ||
@@ -35,1 +35,2 @@ process: "process", | ||
console.log(debug.logs); | ||
console.log(__1.default()); |
{ | ||
"name": "debux", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"description": "Easy-to-use library for debugging your code", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
@@ -14,5 +14,5 @@ # Debux | ||
```js | ||
const Debux = require("debux"); | ||
const debux = require("debux"); | ||
const debug = new Debux(); | ||
const debug = debux(); | ||
@@ -19,0 +19,0 @@ debug.log("This is a log"); |
@@ -30,3 +30,9 @@ import chalk from "chalk"; | ||
module.exports = class Debux { | ||
let existing: null | Debux = null; | ||
module.exports = function(options?: constructOptions): Debux { | ||
return existing ? existing : (existing = new Debux(options)); | ||
}; | ||
export class Debux { | ||
private maxCacheSize: number; | ||
@@ -85,2 +91,2 @@ private cache: string[]; | ||
} | ||
}; | ||
} |
//@ts-ignore | ||
import Debux from ".."; | ||
import debux from ".."; | ||
const debug = new Debux({ maxCacheSize: 10, logLevel: 4 }); | ||
const debug = debux({ maxCacheSize: 10, logLevel: 4 }); | ||
@@ -35,1 +35,3 @@ debug.log(null, { | ||
console.log(debug.logs); | ||
console.log(debux()); |
@@ -1,19 +0,6 @@ | ||
import { constructOptions, Options } from "../src/index"; | ||
import { constructOptions, Debux } from "../src/index"; | ||
export * from "../src/index"; | ||
declare module "debux" { | ||
export default class Debux { | ||
constructor(options: constructOptions); | ||
private maxCacheSize: number; | ||
private cache: string[]; | ||
private logLevel: number; | ||
public log(s: string | null, options?: Options): void; | ||
public error(s: string, options?: Options): void; | ||
public warn(s: string, options?: Options): void; | ||
public info(s: string, options?: Options): void; | ||
public get logs(): string[]; | ||
private static consoleLog(s: string): void; | ||
private constructMessage(s: string, options?: Options): string; | ||
private addCache(log: string): void; | ||
} | ||
export default function(options?: constructOptions): Debux; | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10746
239