better-custom-error
Advanced tools
Comparing version 4.1.2 to 4.1.3
@@ -6,2 +6,6 @@ All notable changes to this project will be documented in this file. | ||
## [4.1.3] - 2023-01-07 | ||
### Dev | ||
- deps upgrade to stop security warnings | ||
## [4.1.2] - 2021-08-14 | ||
@@ -8,0 +12,0 @@ ### Fixed |
import type { Options, CustomErrorConstructor, CustomError as CustomErrorType } from "./types"; | ||
declare const setDefaultOptions: (options: Options) => void; | ||
declare const createError: <D>(name: string, ParentError?: ErrorConstructor, options?: Options | undefined) => CustomErrorConstructor<D>; | ||
declare const createError: <D>(name: string, ParentError?: ErrorConstructor, options?: Options) => CustomErrorConstructor<D>; | ||
export { createError, setDefaultOptions, }; | ||
export type { CustomErrorType as CustomError, CustomErrorConstructor, Options, }; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -19,4 +19,4 @@ "use strict"; | ||
} | ||
const { sourceError, message, details } = index_js_1.parseArguments(arg1, arg2, arg3); | ||
const names = index_js_1.enhanceToString([name]); | ||
const { sourceError, message, details } = (0, index_js_1.parseArguments)(arg1, arg2, arg3); | ||
const names = (0, index_js_1.enhanceToString)([name]); | ||
if (sourceError) { | ||
@@ -27,7 +27,7 @@ if ("names" in sourceError) { | ||
else { | ||
names.push(index_js_1.enhanceToString(index_js_1.getPrototypesNames(sourceError))); | ||
names.push((0, index_js_1.enhanceToString)((0, index_js_1.getPrototypesNames)(sourceError))); | ||
} | ||
} | ||
names.push(...index_js_1.getPrototypesNames(this)); | ||
const useMessage = index_js_1.getMessage(sourceError, message); | ||
names.push(...(0, index_js_1.getPrototypesNames)(this)); | ||
const useMessage = (0, index_js_1.getMessage)(sourceError, message); | ||
Object.defineProperties(this, { | ||
@@ -55,3 +55,3 @@ name: { | ||
enumerable: false, | ||
value: index_js_1.getDetails(sourceError, details), | ||
value: (0, index_js_1.getDetails)(sourceError, details), | ||
writable: true, | ||
@@ -62,3 +62,3 @@ }, | ||
enumerable: false, | ||
value: index_js_1.cleanUpStack(new Error().stack, name, useMessage, useOptions), | ||
value: (0, index_js_1.cleanUpStack)(new Error().stack, name, useMessage, useOptions), | ||
writable: true, | ||
@@ -65,0 +65,0 @@ }, |
@@ -1,2 +0,2 @@ | ||
declare type Names = (string | Names)[]; | ||
type Names = (string | Names)[]; | ||
interface Data { | ||
@@ -10,3 +10,3 @@ } | ||
} | ||
declare type Arg<D> = Error | CustomError | string | D | undefined | null; | ||
type Arg<D> = Error | CustomError | string | D | undefined | null; | ||
interface CustomErrorConstructor<D> extends CustomError { | ||
@@ -18,6 +18,6 @@ new (arg1?: Arg<D>, arg2?: Arg<D>, arg3?: Arg<D>): CustomError<D>; | ||
} | ||
export interface Options { | ||
interface Options { | ||
cleanStackTraces?: boolean; | ||
} | ||
export type { Names, Data, Arg, CustomError, CustomErrorConstructor }; | ||
export type { Options, Names, Data, Arg, CustomError, CustomErrorConstructor }; | ||
//# sourceMappingURL=types.d.ts.map |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
import type { CustomError, Data, Names } from "../types"; | ||
declare const getMessage: (error?: Error | CustomError<{ | ||
[key: string]: unknown; | ||
}> | undefined, message?: string | undefined) => string; | ||
declare const getDetails: (error?: Error | CustomError<{ | ||
[key: string]: unknown; | ||
}> | undefined, details?: Data | undefined) => Data; | ||
declare const getMessage: (error?: Error | CustomError, message?: string) => string; | ||
declare const getDetails: (error?: Error | CustomError, details?: Data) => Data; | ||
declare const getPrototypesNames: (obj: any) => string[]; | ||
@@ -9,0 +5,0 @@ declare const enhanceToString: (array: Names) => Names; |
import type { Options, CustomErrorConstructor, CustomError as CustomErrorType } from "./types"; | ||
declare const setDefaultOptions: (options: Options) => void; | ||
declare const createError: <D>(name: string, ParentError?: ErrorConstructor, options?: Options | undefined) => CustomErrorConstructor<D>; | ||
declare const createError: <D>(name: string, ParentError?: ErrorConstructor, options?: Options) => CustomErrorConstructor<D>; | ||
export { createError, setDefaultOptions, }; | ||
export type { CustomErrorType as CustomError, CustomErrorConstructor, Options, }; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,2 +0,2 @@ | ||
declare type Names = (string | Names)[]; | ||
type Names = (string | Names)[]; | ||
interface Data { | ||
@@ -10,3 +10,3 @@ } | ||
} | ||
declare type Arg<D> = Error | CustomError | string | D | undefined | null; | ||
type Arg<D> = Error | CustomError | string | D | undefined | null; | ||
interface CustomErrorConstructor<D> extends CustomError { | ||
@@ -18,6 +18,6 @@ new (arg1?: Arg<D>, arg2?: Arg<D>, arg3?: Arg<D>): CustomError<D>; | ||
} | ||
export interface Options { | ||
interface Options { | ||
cleanStackTraces?: boolean; | ||
} | ||
export type { Names, Data, Arg, CustomError, CustomErrorConstructor }; | ||
export type { Options, Names, Data, Arg, CustomError, CustomErrorConstructor }; | ||
//# sourceMappingURL=types.d.ts.map |
import type { CustomError, Data, Names } from "../types"; | ||
declare const getMessage: (error?: Error | CustomError<{ | ||
[key: string]: unknown; | ||
}> | undefined, message?: string | undefined) => string; | ||
declare const getDetails: (error?: Error | CustomError<{ | ||
[key: string]: unknown; | ||
}> | undefined, details?: Data | undefined) => Data; | ||
declare const getMessage: (error?: Error | CustomError, message?: string) => string; | ||
declare const getDetails: (error?: Error | CustomError, details?: Data) => Data; | ||
declare const getPrototypesNames: (obj: any) => string[]; | ||
@@ -9,0 +5,0 @@ declare const enhanceToString: (array: Names) => Names; |
{ | ||
"name": "better-custom-error", | ||
"version": "4.1.2", | ||
"version": "4.1.3", | ||
"repository": "git@github.com:dzek69/better-custom-error.git", | ||
@@ -11,5 +11,5 @@ "author": "Jacek Nowacki @dzek69 <git-public@dzek.eu>", | ||
"test:stackTrace": "node test/non-mocha-tests/index.js", | ||
"docs": "typedoc src/index.ts --out docs --listInvalidSymbolLinks --includes tutorials --theme pages-plugin --includeVersion", | ||
"docs": "typedoc src/index.ts --skipErrorChecking --out docs --includeVersion --pluginPages ./pagesconfig.json", | ||
"compile": "yarn compile:esm && yarn compile:cjs", | ||
"compile:esm": "rm -rf esm && tsc && node ./build-scripts/compile.esm.after.mjs", | ||
"compile:esm": "rm -rf esm && tsc --project tsconfig.esm.json && node ./build-scripts/compile.esm.after.mjs", | ||
"compile:cjs": "rm -rf dist && tsc --project tsconfig.cjs.json && node ./build-scripts/compile.cjs.after.mjs", | ||
@@ -22,3 +22,7 @@ "typecheck": "tsc --noEmit", | ||
"start:dev": "nodemon", | ||
"start:dev:compatibility": "TS_NODE_FILES=true yarn start:dev" | ||
"start:dev:compatibility": "TS_NODE_FILES=true yarn start:dev", | ||
"prepare": "husky install", | ||
"updates": "npx --yes npm-check-updates --dep prod", | ||
"updates:dev": "npx --yes npm-check-updates --dep dev", | ||
"updates:all": "npx --yes npm-check-updates" | ||
}, | ||
@@ -37,21 +41,24 @@ "exports": { | ||
"devDependencies": { | ||
"@babel/core": "^7.12.10", | ||
"@babel/preset-env": "^7.12.11", | ||
"@babel/preset-typescript": "^7.12.7", | ||
"@dzek69/eslint-config-base": "^2.0.0", | ||
"@dzek69/eslint-config-typescript": "^0.4.0", | ||
"@types/jest": "^26.0.23", | ||
"@typescript-eslint/eslint-plugin": "^4.11.1", | ||
"@typescript-eslint/parser": "^4.11.1", | ||
"@babel/core": "^7.19.3", | ||
"@babel/preset-env": "^7.19.3", | ||
"@babel/preset-typescript": "^7.18.6", | ||
"@dzek69/eslint-config-base": "^2.3.0", | ||
"@dzek69/eslint-config-typescript": "^1.0.2", | ||
"@types/jest": "^29.0.3", | ||
"@typescript-eslint/eslint-plugin": "^5.38.1", | ||
"@typescript-eslint/parser": "^5.38.1", | ||
"babel-plugin-module-extension": "^0.1.3", | ||
"eslint": "^7.14.0", | ||
"fs-extra": "^9.0.1", | ||
"husky": "^4.3.0", | ||
"jest": "^27.0.6", | ||
"eslint": "^8.24.0", | ||
"fs-extra": "^10.1.0", | ||
"husky": "^8.0.1", | ||
"jest": "^29.1.1", | ||
"must": "^0.13.4", | ||
"nodemon": "^2.0.6", | ||
"ts-node": "^9.0.0", | ||
"typedoc": "^0.21.2", | ||
"typedoc-plugin-pages-fork-fork": "^0.0.3", | ||
"typescript": "^4.2.4" | ||
"nodemon": "^2.0.20", | ||
"ts-node": "^10.9.1", | ||
"typedoc": "^0.23.15", | ||
"typescript": "^4.7.4", | ||
"eslint-plugin-import": "^2.26.0", | ||
"@dzek69/eslint-config-import": "^1.0.0", | ||
"@dzek69/eslint-config-import-typescript": "^1.0.0", | ||
"@knodes/typedoc-plugin-pages": "^0.23.1" | ||
}, | ||
@@ -64,3 +71,3 @@ "husky": { | ||
"libraryTemplate": { | ||
"version": "3.3.1", | ||
"version": "3.6.0", | ||
"language": "typescript", | ||
@@ -67,0 +74,0 @@ "fixDefaultForCommonJS": true, |
@@ -1,2 +0,2 @@ | ||
import { createError } from "./index"; | ||
import { createError } from "./index.js"; | ||
@@ -3,0 +3,0 @@ describe("createError", () => { |
@@ -0,1 +1,3 @@ | ||
import type { Arg, Options, CustomErrorConstructor, CustomError as CustomErrorType } from "./types"; | ||
import { | ||
@@ -9,3 +11,2 @@ parseArguments, | ||
} from "./utils/index.js"; | ||
import type { Arg, Options, CustomErrorConstructor, CustomError as CustomErrorType } from "./types"; | ||
@@ -12,0 +13,0 @@ const defaultOptions: Options = { |
@@ -1,2 +0,2 @@ | ||
import { createError } from "./index"; | ||
import { createError } from "./index.js"; | ||
@@ -3,0 +3,0 @@ // TS integration tests, they aren't useful in runtime |
@@ -30,6 +30,6 @@ type Names = (string | Names)[]; | ||
*/ | ||
export interface Options { | ||
interface Options { | ||
cleanStackTraces?: boolean; | ||
} | ||
export type { Names, Data, Arg, CustomError, CustomErrorConstructor }; | ||
export type { Options, Names, Data, Arg, CustomError, CustomErrorConstructor }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
307332
22
81
2468