dolphindb 2.0.1036 → 2.0.1101
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/CHANGELOG.md +15 -0
- package/CHANGELOG.zh.md +15 -0
- package/README.md +49 -36
- package/README.zh.md +38 -25
- package/browser.js +10 -2
- package/browser.js.map +1 -1
- package/index.js +11 -2
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/shared/utils.d.ts +4 -0
- package/shared/utils.js +17 -0
- package/shared/utils.js.map +1 -0
package/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import { concat, assert, inspect, typed_array_to_buffer, connect_websocket, Lock
|
|
|
8
8
|
import { t } from './i18n/index.js';
|
|
9
9
|
import { DdbDecimal128Serializor } from './data-types/decimal-128.js';
|
|
10
10
|
import { BigInt128Array } from './shared/bigint-128-array.js';
|
|
11
|
-
import { is_decimal_type, is_decimal_null_value } from './shared/utils
|
|
11
|
+
import { is_decimal_type, is_decimal_null_value, get_duration_unit } from './shared/utils.js';
|
|
12
12
|
import { nulls, DdbChartType, DdbDurationUnit, DdbForm, DdbFunctionType, DdbType } from './shared/constants.js';
|
|
13
13
|
export * from './shared/constants.js';
|
|
14
14
|
// Simulate other TypedArray behavior in nodejs
|
|
@@ -958,6 +958,15 @@ export class DdbObj {
|
|
|
958
958
|
case DdbType.complex:
|
|
959
959
|
case DdbType.point:
|
|
960
960
|
return [value];
|
|
961
|
+
case DdbType.duration: {
|
|
962
|
+
let bufs = new Int32Array(length * 2);
|
|
963
|
+
for (let i = 0; i < length; i++) {
|
|
964
|
+
const { data, unit } = value[i];
|
|
965
|
+
bufs[2 * i] = data;
|
|
966
|
+
bufs[2 * i + 1] = unit;
|
|
967
|
+
}
|
|
968
|
+
return [bufs];
|
|
969
|
+
}
|
|
961
970
|
case DdbType.any: {
|
|
962
971
|
// [1, 2, 'a', 'aaa']
|
|
963
972
|
// any[4](<Buffer
|
|
@@ -1466,7 +1475,7 @@ export function format(type, value, le, options = {}) {
|
|
|
1466
1475
|
}
|
|
1467
1476
|
case DdbType.duration: {
|
|
1468
1477
|
const { data, unit } = value;
|
|
1469
|
-
const str = `${data}${DdbDurationUnit[unit]}`;
|
|
1478
|
+
const str = `${data}${DdbDurationUnit[unit] ?? get_duration_unit(unit)}`;
|
|
1470
1479
|
return options.colors ? str.magenta : str;
|
|
1471
1480
|
}
|
|
1472
1481
|
case DdbType.decimal32:
|