dolphindb 2.0.1009 → 2.0.1010

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/index.d.ts CHANGED
@@ -152,7 +152,7 @@ export declare class DdbObj<TValue extends DdbValue = DdbValue> {
152
152
  ];
153
153
  pack(): Uint8Array;
154
154
  static pack_vector_body(value: DdbVectorValue, type: DdbType, length: number): ArrayBufferView[];
155
- [inspect.custom](depth: number, _options: InspectOptions, _inspect: any): string;
155
+ [inspect.custom](depth: number, _options: InspectOptions, _inspect: any): string | TValue;
156
156
  inspect_type(): string;
157
157
  /** 自动转换 js string, boolean 为 DdbObj */
158
158
  static to_ddbobj(value: DdbObj | string | boolean): DdbObj;
package/index.js CHANGED
@@ -995,7 +995,11 @@ export class DdbObj {
995
995
  const data = (() => {
996
996
  switch (this.form) {
997
997
  case DdbForm.scalar:
998
- return format(this.type, this.value, this.le, options);
998
+ // 如果类型为 string, 则不进行格式化处理
999
+ if (this.type === DdbType.string)
1000
+ return this.value;
1001
+ else
1002
+ return format(this.type, this.value, this.le, options);
999
1003
  case DdbForm.vector:
1000
1004
  case DdbForm.pair:
1001
1005
  case DdbForm.set: {
@@ -1121,7 +1125,11 @@ export class DdbObj {
1121
1125
  return inspect(typed_array_to_buffer(this.value), options);
1122
1126
  return inspect(this.value, options);
1123
1127
  })();
1124
- return `${options.colors ? type.blue : type}(${this.name ? `${inspect(this.name, options)}, ` : ''}${data})`;
1128
+ // 如果类型为 string 则不需要加上类型名
1129
+ if (this.form === DdbForm.scalar && this.type === DdbType.string)
1130
+ return data;
1131
+ else
1132
+ return `${options.colors ? type.blue : type}(${this.name ? `${inspect(this.name, options)}, ` : ''}${data})`;
1125
1133
  }
1126
1134
  inspect_type() {
1127
1135
  const tname = DdbType[this.type];