dolphindb 3.1.21 → 3.1.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/browser.d.ts CHANGED
@@ -171,7 +171,7 @@ export interface InspectOptions {
171
171
  colors?: boolean;
172
172
  /** `null` decimal places 小数位数 */
173
173
  decimals?: number;
174
- /** `false` 决定 null 值如何返回. nullstr ? 'null' : '' */
174
+ /** `在 format 中默认为 false,在 toString 中默认为 true` 决定 null 值如何返回. nullstr ? 'null' : '' */
175
175
  nullstr?: boolean;
176
176
  /** `在 format 中默认为 false,在 toString 中默认为 true` 决定 string, symbol, char 类型是否加引号 */
177
177
  quote?: boolean;
@@ -184,7 +184,7 @@ export interface InspectOptions {
184
184
  export declare function format(type: DdbType, value: DdbValue, le: boolean, options?: InspectOptions): string;
185
185
  /** 格式化向量、集合中的第 index 项为字符串,空值返回 'null' 字符串 formatted vector, the index-th item in the collection is a string, a null value returns a 'null' string */
186
186
  export declare function formati(obj: DdbVectorObj, index: number, options?: InspectOptions): string;
187
- export declare function convert(type: DdbType, value: DdbValue, le: boolean, { blob, char, timestamp }?: ConvertOptions): string | number | bigint | boolean | number[] | DdbFunctionDefValue | DdbDurationValue | DdbDecimal32Value | DdbDecimal64Value | DdbDecimal32VectorValue | DdbDecimal64VectorValue | DdbSymbolExtendedValue | string[] | DdbExtObjValue | DdbTensorValue | Uint8Array<ArrayBufferLike> | DdbDecimal128VectorValue | BigInt128Array | Int8Array<ArrayBufferLike> | Int16Array<ArrayBufferLike> | Int32Array<ArrayBufferLike> | Float32Array<ArrayBufferLike> | Float64Array<ArrayBufferLike> | BigInt64Array<ArrayBufferLike> | IotVectorItemValue | DdbArrayVectorValue | DdbDurationVectorValue | Uint8Array<ArrayBufferLike>[] | DdbObj<DdbValue>[] | DdbMatrixValue | DdbChartValue;
187
+ export declare function convert(type: DdbType, value: DdbValue, le: boolean, { blob, char, timestamp }?: ConvertOptions): string | number | bigint | boolean | number[] | string[] | DdbFunctionDefValue | DdbDurationValue | DdbDecimal32Value | DdbDecimal64Value | DdbDecimal32VectorValue | DdbDecimal64VectorValue | DdbSymbolExtendedValue | DdbExtObjValue | DdbTensorValue | Uint8Array<ArrayBufferLike> | Int8Array<ArrayBufferLike> | Int16Array<ArrayBufferLike> | Int32Array<ArrayBufferLike> | Float32Array<ArrayBufferLike> | Float64Array<ArrayBufferLike> | BigInt64Array<ArrayBufferLike> | BigInt128Array | Uint8Array<ArrayBufferLike>[] | DdbObj<DdbValue>[] | IotVectorItemValue | DdbArrayVectorValue | DdbDecimal128VectorValue | DdbDurationVectorValue | DdbMatrixValue | DdbChartValue;
188
188
  /** 转换一个向量到 js 原生数组 */
189
189
  export declare function converts(type: DdbType, value: DdbVectorValue, rows: number, le: boolean, options?: ConvertOptions): any[] | Uint8Array;
190
190
  /** 构造 void 类型,默认为 `DdbVoidType.undefined` */
package/browser.js CHANGED
@@ -1567,10 +1567,9 @@ export class DdbObj {
1567
1567
  }
1568
1568
  }
1569
1569
  const grey_nullstr = grey('null');
1570
- const nullstr = 'null';
1571
1570
  function get_nullstr(options) {
1572
1571
  return options.nullstr ?
1573
- options.colors ? grey_nullstr : nullstr
1572
+ options.colors ? grey_nullstr : 'null'
1574
1573
  :
1575
1574
  '';
1576
1575
  }
@@ -1598,7 +1597,10 @@ function format_time(type, value, options) {
1598
1597
  }
1599
1598
  function format_number(type, value, options) {
1600
1599
  if (value === null || value === number_nulls.get(type))
1601
- return options.colors ? grey_nullstr : nullstr;
1600
+ return options.nullstr ?
1601
+ options.colors ? grey_nullstr : 'null'
1602
+ :
1603
+ '';
1602
1604
  const str = get_number_formatter(type === DdbType.int || type === DdbType.long || type === DdbType.short, options.decimals, options.grouping).format(value);
1603
1605
  return options.colors ? green(str) : str;
1604
1606
  }
@@ -1607,12 +1609,12 @@ export function format(type, value, le, options = {}) {
1607
1609
  switch (type) {
1608
1610
  case DdbType.void: {
1609
1611
  return options.nullstr ?
1610
- ''
1612
+ value === DdbVoidType.default ?
1613
+ options.colors ? grey('default') : 'default'
1614
+ :
1615
+ options.colors ? grey_nullstr : 'null'
1611
1616
  :
1612
- value === DdbVoidType.default ?
1613
- options.colors ? grey('default') : 'default'
1614
- :
1615
- options.colors ? grey_nullstr : nullstr;
1617
+ '';
1616
1618
  }
1617
1619
  case DdbType.bool:
1618
1620
  if (value === null || value === nulls.int8)