web3-utils
Advanced tools
Comparing version 4.2.4-dev.1ab7a6b.0 to 4.2.4-dev.93296c2.0
@@ -22,2 +22,2 @@ import { DataFormat, FormatType } from 'web3-types'; | ||
export declare const convert: (data: Record<string, unknown> | unknown[] | unknown, schema: JsonSchema, dataPath: string[], format: DataFormat, oneOfPath?: [string, number][]) => unknown; | ||
export declare const format: <DataType extends unknown, ReturnType_1 extends DataFormat>(schema: ValidationSchemaInput | JsonSchema, data: DataType, returnFormat: ReturnType_1) => FormatType<DataType, ReturnType_1>; | ||
export declare const format: <DataType extends unknown, ReturnType_1 extends DataFormat>(schema: ValidationSchemaInput | JsonSchema, data: DataType, returnFormat?: ReturnType_1) => FormatType<DataType, ReturnType_1>; |
@@ -230,3 +230,3 @@ "use strict"; | ||
exports.convert = convert; | ||
const format = (schema, data, returnFormat) => { | ||
const format = (schema, data, returnFormat = web3_types_1.DEFAULT_RETURN_FORMAT) => { | ||
let dataToParse; | ||
@@ -233,0 +233,0 @@ if ((0, web3_validator_1.isObject)(data)) { |
@@ -18,3 +18,3 @@ /* | ||
import { FormatterError } from 'web3-errors'; | ||
import { FMT_BYTES, FMT_NUMBER } from 'web3-types'; | ||
import { FMT_BYTES, FMT_NUMBER, DEFAULT_RETURN_FORMAT, } from 'web3-types'; | ||
import { isNullish, isObject, utils } from 'web3-validator'; | ||
@@ -225,3 +225,3 @@ import { bytesToUint8Array, bytesToHex, numberToHex, toBigInt } from './converters.js'; | ||
}; | ||
export const format = (schema, data, returnFormat) => { | ||
export const format = (schema, data, returnFormat = DEFAULT_RETURN_FORMAT) => { | ||
let dataToParse; | ||
@@ -228,0 +228,0 @@ if (isObject(data)) { |
@@ -22,3 +22,3 @@ import { DataFormat, FormatType } from 'web3-types'; | ||
export declare const convert: (data: Record<string, unknown> | unknown[] | unknown, schema: JsonSchema, dataPath: string[], format: DataFormat, oneOfPath?: [string, number][]) => unknown; | ||
export declare const format: <DataType extends unknown, ReturnType_1 extends DataFormat>(schema: ValidationSchemaInput | JsonSchema, data: DataType, returnFormat: ReturnType_1) => FormatType<DataType, ReturnType_1>; | ||
export declare const format: <DataType extends unknown, ReturnType_1 extends DataFormat>(schema: ValidationSchemaInput | JsonSchema, data: DataType, returnFormat?: ReturnType_1) => FormatType<DataType, ReturnType_1>; | ||
//# sourceMappingURL=formatter.d.ts.map |
{ | ||
"name": "web3-utils", | ||
"sideEffects": false, | ||
"version": "4.2.4-dev.1ab7a6b.0+1ab7a6b", | ||
"version": "4.2.4-dev.93296c2.0+93296c2", | ||
"description": "Collection of utility functions used in web3.js.", | ||
@@ -68,7 +68,7 @@ "main": "./lib/commonjs/index.js", | ||
"eventemitter3": "^5.0.1", | ||
"web3-errors": "1.1.5-dev.1ab7a6b.0+1ab7a6b", | ||
"web3-types": "1.6.1-dev.1ab7a6b.0+1ab7a6b", | ||
"web3-validator": "2.0.6-dev.1ab7a6b.0+1ab7a6b" | ||
"web3-errors": "1.1.5-dev.93296c2.0+93296c2", | ||
"web3-types": "1.6.1-dev.93296c2.0+93296c2", | ||
"web3-validator": "2.0.6-dev.93296c2.0+93296c2" | ||
}, | ||
"gitHead": "1ab7a6b8aa46d5984d41fd69c78103fcf1f0973b" | ||
"gitHead": "93296c2e0ec299c506591d790236e5dd96291757" | ||
} |
@@ -18,3 +18,10 @@ /* | ||
import { FormatterError } from 'web3-errors'; | ||
import { Bytes, DataFormat, FMT_BYTES, FMT_NUMBER, FormatType } from 'web3-types'; | ||
import { | ||
Bytes, | ||
DataFormat, | ||
FMT_BYTES, | ||
FMT_NUMBER, | ||
FormatType, | ||
DEFAULT_RETURN_FORMAT, | ||
} from 'web3-types'; | ||
import { isNullish, isObject, JsonSchema, utils, ValidationSchemaInput } from 'web3-validator'; | ||
@@ -281,3 +288,3 @@ import { bytesToUint8Array, bytesToHex, numberToHex, toBigInt } from './converters.js'; | ||
data: DataType, | ||
returnFormat: ReturnType, | ||
returnFormat: ReturnType = DEFAULT_RETURN_FORMAT as ReturnType, | ||
): FormatType<DataType, ReturnType> => { | ||
@@ -284,0 +291,0 @@ let dataToParse: Record<string, unknown> | unknown[] | unknown; |
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
523714
9931