dolphindb 3.1.20 → 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 +1 -1
- package/browser.js +11 -9
- package/browser.js.map +1 -1
- package/index.js +2 -3
- package/index.js.map +1 -1
- package/package.json +4 -4
- package/test.js.map +1 -1
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
|
-
/**
|
|
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;
|
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 :
|
|
1572
|
+
options.colors ? grey_nullstr : 'null'
|
|
1574
1573
|
:
|
|
1575
1574
|
'';
|
|
1576
1575
|
}
|
|
@@ -1578,7 +1577,7 @@ function format_time(type, value, options) {
|
|
|
1578
1577
|
if (value === null ||
|
|
1579
1578
|
value === ((type === DdbType.timestamp ||
|
|
1580
1579
|
type === DdbType.nanotime ||
|
|
1581
|
-
type === DdbType.nanotimestamp)
|
|
1580
|
+
type === DdbType.nanotimestamp) ? nulls.int64 : nulls.int32))
|
|
1582
1581
|
return get_nullstr(options);
|
|
1583
1582
|
let str;
|
|
1584
1583
|
// formatter 可能会在 value 不属于 new Date() 有效值时,调用 抛出错误,这里统一处理
|
|
@@ -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.
|
|
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
|
-
|
|
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)
|