dolphindb 2.0.528 → 2.0.531
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 +2 -1
- package/browser.js +31 -29
- package/browser.js.map +1 -1
- package/docs.en.json +2732 -276
- package/docs.zh.json +1939 -360
- package/index.d.ts +1 -0
- package/index.js +28 -27
- package/index.js.map +1 -1
- package/package.json +5 -5
package/browser.d.ts
CHANGED
|
@@ -206,7 +206,8 @@ export declare class DdbObj<T extends DdbValue = DdbValue> {
|
|
|
206
206
|
];
|
|
207
207
|
pack(): Uint8Array;
|
|
208
208
|
static pack_vector_body(value: DdbVectorValue, type: DdbType, length: number): ArrayBufferView[];
|
|
209
|
-
toString(): any;
|
|
209
|
+
toString(colors?: boolean): any;
|
|
210
|
+
inspect_type(): string;
|
|
210
211
|
/** 自动转换 js string, boolean 为 DdbObj */
|
|
211
212
|
static to_ddbobj(value: DdbObj | string | boolean): DdbObj;
|
|
212
213
|
/** 转换 js 数组为 DdbObj[] */
|
package/browser.js
CHANGED
|
@@ -4,6 +4,7 @@ dayjs.extend(DayjsCustomParseFormat);
|
|
|
4
4
|
import ipaddrjs from 'ipaddr.js';
|
|
5
5
|
const { fromByteArray: buf2ipaddr } = ipaddrjs;
|
|
6
6
|
import 'xshell/prototype.browser.js';
|
|
7
|
+
import { blue } from 'xshell/chalk.browser.js';
|
|
7
8
|
import { concat } from 'xshell/utils.browser.js';
|
|
8
9
|
import { connect_websocket } from 'xshell/net.browser.js';
|
|
9
10
|
export var DdbForm;
|
|
@@ -988,34 +989,8 @@ export class DdbObj {
|
|
|
988
989
|
throw new Error(`vector ${DdbType[type]} 暂不支持序列化`);
|
|
989
990
|
}
|
|
990
991
|
}
|
|
991
|
-
toString() {
|
|
992
|
-
const type = (
|
|
993
|
-
const tname = DdbType[this.type];
|
|
994
|
-
switch (this.form) {
|
|
995
|
-
case DdbForm.scalar:
|
|
996
|
-
if (this.type === DdbType.functiondef)
|
|
997
|
-
return `functiondef<${DdbFunctionType[this.value.type]}>`;
|
|
998
|
-
return tname;
|
|
999
|
-
case DdbForm.vector:
|
|
1000
|
-
if (64 <= this.type && this.type < 128)
|
|
1001
|
-
return `${DdbType[this.type - 64]}[][${this.rows}]`;
|
|
1002
|
-
return `${tname}[${this.rows}]`;
|
|
1003
|
-
case DdbForm.pair:
|
|
1004
|
-
return `pair<${tname}>`;
|
|
1005
|
-
case DdbForm.set:
|
|
1006
|
-
return `set<${tname}>[${this.rows}]`;
|
|
1007
|
-
case DdbForm.table:
|
|
1008
|
-
return `table[${this.rows}r][${this.cols}c]`;
|
|
1009
|
-
case DdbForm.dict:
|
|
1010
|
-
return `dict<${DdbType[this.value[0].type]}, ${DdbType[this.value[1].type]}>`;
|
|
1011
|
-
case DdbForm.chart:
|
|
1012
|
-
return `chart<${DdbChartType[this.value.type]}>`;
|
|
1013
|
-
case DdbForm.matrix:
|
|
1014
|
-
return `matrix<${tname}>[${this.rows}r][${this.cols}c]`;
|
|
1015
|
-
default:
|
|
1016
|
-
return `${DdbForm[this.form]} ${tname}`;
|
|
1017
|
-
}
|
|
1018
|
-
})();
|
|
992
|
+
toString(colors = false) {
|
|
993
|
+
const type = this.inspect_type();
|
|
1019
994
|
const data = (() => {
|
|
1020
995
|
switch (this.form) {
|
|
1021
996
|
case DdbForm.scalar:
|
|
@@ -1103,7 +1078,34 @@ export class DdbObj {
|
|
|
1103
1078
|
}
|
|
1104
1079
|
return String(this.value);
|
|
1105
1080
|
})();
|
|
1106
|
-
return `${type}(${this.name ? `'${this.name}', ` : ''}${data})\n`;
|
|
1081
|
+
return `${colors ? blue(type) : type}(${this.name ? `'${this.name}', ` : ''}${data})\n`;
|
|
1082
|
+
}
|
|
1083
|
+
inspect_type() {
|
|
1084
|
+
const tname = DdbType[this.type];
|
|
1085
|
+
switch (this.form) {
|
|
1086
|
+
case DdbForm.scalar:
|
|
1087
|
+
if (this.type === DdbType.functiondef)
|
|
1088
|
+
return `functiondef<${DdbFunctionType[this.value.type]}>`;
|
|
1089
|
+
return tname;
|
|
1090
|
+
case DdbForm.vector:
|
|
1091
|
+
if (64 <= this.type && this.type < 128)
|
|
1092
|
+
return `${DdbType[this.type - 64]}[][${this.rows}]`;
|
|
1093
|
+
return `${tname}[${this.rows}]`;
|
|
1094
|
+
case DdbForm.pair:
|
|
1095
|
+
return `pair<${tname}>`;
|
|
1096
|
+
case DdbForm.set:
|
|
1097
|
+
return `set<${tname}>[${this.rows}]`;
|
|
1098
|
+
case DdbForm.table:
|
|
1099
|
+
return `table[${this.rows}r][${this.cols}c]`;
|
|
1100
|
+
case DdbForm.dict:
|
|
1101
|
+
return `dict<${DdbType[this.value[0].type]}, ${DdbType[this.value[1].type]}>`;
|
|
1102
|
+
case DdbForm.chart:
|
|
1103
|
+
return `chart<${DdbChartType[this.value.type]}>`;
|
|
1104
|
+
case DdbForm.matrix:
|
|
1105
|
+
return `matrix<${tname}>[${this.rows}r][${this.cols}c]`;
|
|
1106
|
+
default:
|
|
1107
|
+
return `${DdbForm[this.form]} ${tname}`;
|
|
1108
|
+
}
|
|
1107
1109
|
}
|
|
1108
1110
|
/** 自动转换 js string, boolean 为 DdbObj */
|
|
1109
1111
|
static to_ddbobj(value) {
|