Module convert
Convert Functions
Convert BigInt Functions
Convert Error Functions
Convert Map Functions
Convert Number Functions
Convert To Functions
Other Functions
Convert Functions
convertToError
- convertToError(error: any): Error | EvalError | RangeError | ReferenceError | SyntaxError | TypeError | URIError
-
Parameters
Returns Error
|
EvalError
|
RangeError
|
ReferenceError
|
SyntaxError
|
TypeError
|
URIError
Convert BigInt Functions
convertBigIntToJson
- convertBigIntToJson(integer: BigInt): number | string
-
Parameters
Returns number
|
string
Number or string.
Convert Error Functions
convertErrorToJson
- convertErrorToJson(error: Error | EvalError | RangeError | ReferenceError | SyntaxError | TypeError | URIError | Record<string, any>, shouldRemoveStackTrace?: boolean): Record<string, string>
-
Parameters
-
error: Error | EvalError | RangeError | ReferenceError | SyntaxError | TypeError | URIError | Record<string, any>
-
shouldRemoveStackTrace: boolean = false
Returns Record<string, string>
convertErrorToObject
- convertErrorToObject(error: Error | EvalError | RangeError | ReferenceError | SyntaxError | TypeError | URIError | Record<string, any>, shouldRemoveStackTrace?: boolean, shouldBeJson?: boolean): Record<string, any>
-
Parameters
-
error: Error | EvalError | RangeError | ReferenceError | SyntaxError | TypeError | URIError | Record<string, any>
-
shouldRemoveStackTrace: boolean = true
-
shouldBeJson: boolean = false
Returns Record<string, any>
convertErrorToString
- convertErrorToString(error: Error | EvalError | RangeError | ReferenceError | SyntaxError | TypeError | URIError | Record<string, any>): string
-
Parameters
-
error: Error | EvalError | RangeError | ReferenceError | SyntaxError | TypeError | URIError | Record<string, any>
Returns string
errorToCaller
- errorToCaller(error: Error | EvalError | RangeError | ReferenceError | SyntaxError | TypeError | URIError): string
-
Parameters
-
error: Error | EvalError | RangeError | ReferenceError | SyntaxError | TypeError | URIError
Returns string
- Function, class and method name. Or 'Module._compile' and 'ModuleJob.run' if root.
errorToMessage
- errorToMessage(error: any, defaultMessage?: string): string
-
Parameters
-
error: any
-
Optional defaultMessage: string
Returns string
Convert Map Functions
convertMapToObject
- convertMapToObject(map: Map<any, any>): Record<string, any>
-
Parameters
Returns Record<string, any>
Plain object.
Convert Number Functions
convertNumberToJson
- convertNumberToJson(value: BigInt | number | string, onFailure?: number | string): number | string
-
Parameters
-
value: BigInt | number | string
-
onFailure: number | string = 0
Returns number
|
string
Number or string.
Convert To Functions
convertToSingleLine
- convertToSingleLine(record: any, prettify?: boolean): string
-
Parameters
-
record: any
-
prettify: boolean = false
Returns string
Single line string
Other Functions
convertArrayBufferToString
- convertArrayBufferToString(buffer: ArrayBuffer): string
-
Parameters
Returns string
convertArrayToObject
- convertArrayToObject(array: any[]): object
-
Parameters
Returns object
convertStringToArrayBuffer
- convertStringToArrayBuffer(text: string): ArrayBuffer
-
Parameters
Returns ArrayBuffer
convertToFlag
- convertToFlag(value: any, onEmpty?: boolean, onUnParsable?: boolean): boolean
-
Parameters
-
value: any
-
onEmpty: boolean = false
-
onUnParsable: boolean = ...
Returns boolean
convertToHash
- convertToHash(value: any, asString: false, seed: number): number
- convertToHash(value: any, asString: "true", seed: number): string
-
Parameters
-
value: any
-
asString: false
-
seed: number
Returns number
-
Parameters
-
value: any
-
asString: "true"
-
seed: number
Returns string
convertToJsonData
- convertToJsonData(value: any, returnsUndefined?: boolean): boolean | null | number | string | undefined | unknown[] | Record<string, unknown>
-
Parameters
-
value: any
-
returnsUndefined: boolean = true
Returns boolean
|
null
|
number
|
string
|
undefined
|
unknown[]
|
Record<string, unknown>
convertToPlainObject
- convertToPlainObject(object: object): object
-
Parameters
Returns object
convertToError
Converts anything to error.
import { convertToError } from "@corefunc/corefunc/convert/to/error";
0.3.47