common-types
Advanced tools
Comparing version 1.4.2 to 1.5.0
@@ -84,21 +84,1 @@ /** | ||
} | ||
export interface IVerboseError { | ||
/** A short and unique identifier for the error; typically would not have any spaces in it */ | ||
code: string; | ||
/** A user-friendly description of the error message */ | ||
message: string; | ||
module?: string; | ||
function?: string; | ||
fileName?: string; | ||
stackFrames?: any[]; | ||
} | ||
export declare type LazyString = () => string; | ||
export interface IStackFrame { | ||
getTypeName: LazyString; | ||
getFunctionName: LazyString; | ||
getMethodName: LazyString; | ||
getFileName: LazyString; | ||
getLineNumber: LazyString; | ||
getColumnNumber: LazyString; | ||
isNative: LazyString | string; | ||
} |
@@ -1,2 +0,4 @@ | ||
export var STAGE; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var STAGE; | ||
(function (STAGE) { | ||
@@ -11,4 +13,4 @@ STAGE["prod"] = "prod"; | ||
STAGE["development"] = "dev"; | ||
})(STAGE || (STAGE = {})); | ||
export var FirebaseEvent; | ||
})(STAGE = exports.STAGE || (exports.STAGE = {})); | ||
var FirebaseEvent; | ||
(function (FirebaseEvent) { | ||
@@ -20,85 +22,3 @@ FirebaseEvent["value"] = "value"; | ||
FirebaseEvent["child_changed"] = "child_changed"; | ||
})(FirebaseEvent || (FirebaseEvent = {})); | ||
// export class VerboseError extends Error implements IVerboseError { | ||
// private static stackParser(err: VerboseError): void | any[] { | ||
// return undefined; | ||
// } | ||
// /** | ||
// * If you want to use a library like stack-trace(node) or stacktrace-js(client) add in the "get" | ||
// * function that they provide | ||
// */ | ||
// public static setStackParser(fn: (err: IVerboseError) => any) { | ||
// VerboseError.stackParser = fn; | ||
// } | ||
// public static useColor: true; | ||
// public static filePathDepth: 3; | ||
// code: string; | ||
// message: string; | ||
// module?: string; | ||
// function?: string; | ||
// stackFrames?: IStackFrame[]; | ||
// constructor(err: IVerboseError, ...args: any[]) { | ||
// super(...args); | ||
// this.code = err.code; | ||
// this.message = err.message; | ||
// this.module = err.module; | ||
// this.function = err.function; | ||
// const stackFrames = VerboseError.stackParser(this); | ||
// if (stackFrames) { | ||
// this.stackFrames = stackFrames.filter( | ||
// frame => (frame.getFileName() || "").indexOf("common-types") === -1 | ||
// ); | ||
// this.function = stackFrames[0].getMethodName(); | ||
// this.stack = | ||
// this.message + | ||
// "\n\n" + | ||
// this.stackFrames | ||
// .map(frame => { | ||
// const isNative = | ||
// typeof frame.isNative === "function" | ||
// ? frame.isNative() | ||
// : frame.isNative; | ||
// const colorize = (content: string) => | ||
// VerboseError.useColor && isNative | ||
// ? chalk.grey.italic(content) | ||
// : content; | ||
// const className = frame.getTypeName() | ||
// ? frame.getTypeName() + " → " | ||
// : ""; | ||
// const functionName = | ||
// frame.getMethodName() || frame.getFunctionName() || "<anonymous>"; | ||
// const classAndFunction = VerboseError.useColor | ||
// ? chalk.bold(`${className}${functionName}`) | ||
// : `${className}${functionName}`; | ||
// const fileName = (frame.getFileName() || "") | ||
// .split("/") | ||
// .slice(-1 * VerboseError.filePathDepth) | ||
// .join("/"); | ||
// const details = isNative | ||
// ? "( native function )" | ||
// : `[ line ${frame.getLineNumber()}, col ${frame.getColumnNumber()} in ${fileName} ]`; | ||
// return colorize(`\t at ${classAndFunction} ${details}`); | ||
// }) | ||
// .join("\n"); | ||
// } else { | ||
// this.stack = this.stack | ||
// .split("\n") | ||
// .filter(line => line.indexOf("VerboseError") === -1) | ||
// .join("\n"); | ||
// } | ||
// } | ||
// toString() { | ||
// return this.message + this.stack; | ||
// } | ||
// toJSON() { | ||
// return JSON.stringify(this.toObject(), null, 2); | ||
// } | ||
// toObject() { | ||
// return { | ||
// code: this.code, | ||
// message: this.message, | ||
// module: this.module | ||
// }; | ||
// } | ||
// } | ||
})(FirebaseEvent = exports.FirebaseEvent || (exports.FirebaseEvent = {})); | ||
//# sourceMappingURL=common-types.js.map |
{ | ||
"name": "common-types", | ||
"version": "1.4.2", | ||
"version": "1.5.0", | ||
"description": "Common types not included in Typescript", | ||
@@ -5,0 +5,0 @@ "main": "lib/common-types.js", |
@@ -104,113 +104,1 @@ // import chalk from "chalk"; | ||
} | ||
// ERRORS | ||
export interface IVerboseError { | ||
/** A short and unique identifier for the error; typically would not have any spaces in it */ | ||
code: string; | ||
/** A user-friendly description of the error message */ | ||
message: string; | ||
module?: string; | ||
function?: string; | ||
fileName?: string; | ||
stackFrames?: any[]; | ||
} | ||
export type LazyString = () => string; | ||
export interface IStackFrame { | ||
getTypeName: LazyString; | ||
getFunctionName: LazyString; | ||
getMethodName: LazyString; | ||
getFileName: LazyString; | ||
getLineNumber: LazyString; | ||
getColumnNumber: LazyString; | ||
isNative: LazyString | string; | ||
} | ||
// export class VerboseError extends Error implements IVerboseError { | ||
// private static stackParser(err: VerboseError): void | any[] { | ||
// return undefined; | ||
// } | ||
// /** | ||
// * If you want to use a library like stack-trace(node) or stacktrace-js(client) add in the "get" | ||
// * function that they provide | ||
// */ | ||
// public static setStackParser(fn: (err: IVerboseError) => any) { | ||
// VerboseError.stackParser = fn; | ||
// } | ||
// public static useColor: true; | ||
// public static filePathDepth: 3; | ||
// code: string; | ||
// message: string; | ||
// module?: string; | ||
// function?: string; | ||
// stackFrames?: IStackFrame[]; | ||
// constructor(err: IVerboseError, ...args: any[]) { | ||
// super(...args); | ||
// this.code = err.code; | ||
// this.message = err.message; | ||
// this.module = err.module; | ||
// this.function = err.function; | ||
// const stackFrames = VerboseError.stackParser(this); | ||
// if (stackFrames) { | ||
// this.stackFrames = stackFrames.filter( | ||
// frame => (frame.getFileName() || "").indexOf("common-types") === -1 | ||
// ); | ||
// this.function = stackFrames[0].getMethodName(); | ||
// this.stack = | ||
// this.message + | ||
// "\n\n" + | ||
// this.stackFrames | ||
// .map(frame => { | ||
// const isNative = | ||
// typeof frame.isNative === "function" | ||
// ? frame.isNative() | ||
// : frame.isNative; | ||
// const colorize = (content: string) => | ||
// VerboseError.useColor && isNative | ||
// ? chalk.grey.italic(content) | ||
// : content; | ||
// const className = frame.getTypeName() | ||
// ? frame.getTypeName() + " → " | ||
// : ""; | ||
// const functionName = | ||
// frame.getMethodName() || frame.getFunctionName() || "<anonymous>"; | ||
// const classAndFunction = VerboseError.useColor | ||
// ? chalk.bold(`${className}${functionName}`) | ||
// : `${className}${functionName}`; | ||
// const fileName = (frame.getFileName() || "") | ||
// .split("/") | ||
// .slice(-1 * VerboseError.filePathDepth) | ||
// .join("/"); | ||
// const details = isNative | ||
// ? "( native function )" | ||
// : `[ line ${frame.getLineNumber()}, col ${frame.getColumnNumber()} in ${fileName} ]`; | ||
// return colorize(`\t at ${classAndFunction} ${details}`); | ||
// }) | ||
// .join("\n"); | ||
// } else { | ||
// this.stack = this.stack | ||
// .split("\n") | ||
// .filter(line => line.indexOf("VerboseError") === -1) | ||
// .join("\n"); | ||
// } | ||
// } | ||
// toString() { | ||
// return this.message + this.stack; | ||
// } | ||
// toJSON() { | ||
// return JSON.stringify(this.toObject(), null, 2); | ||
// } | ||
// toObject() { | ||
// return { | ||
// code: this.code, | ||
// message: this.message, | ||
// module: this.module | ||
// }; | ||
// } | ||
// } |
{ | ||
"compilerOptions": { | ||
"declaration": true, | ||
"module": "es2015", | ||
"module": "commonjs", | ||
"target": "es2015", | ||
@@ -6,0 +6,0 @@ "moduleResolution": "node", |
Sorry, the diff of this file is not supported yet
8959
219