@d-matrix/utils 1.18.0 → 1.18.1

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/dist/echarts.js CHANGED
@@ -68,7 +68,7 @@ export function fill(dataSource, xAxisField, yAxisField) {
68
68
  */
69
69
  export const getDiffRate = (first, maxDiff, decimalPlaces = 2, splitNumber = 5) => {
70
70
  let diffRate = 1.2;
71
- if (first === 0)
71
+ if (first === 0 || maxDiff === 0)
72
72
  return diffRate;
73
73
  const minDiff = 1 / Math.pow(10, decimalPlaces);
74
74
  function calc(f, d) {
package/dist/types.d.ts CHANGED
@@ -13,3 +13,5 @@ export declare type FunctionPropertyNames<T> = {
13
13
  export declare type NonFunctionPropertyNames<T> = {
14
14
  [P in keyof T]-?: T[P] extends Function ? never : P;
15
15
  }[keyof T];
16
+ /** 获取对象中key的值,返回由这些值组成的union type */
17
+ export declare type ValueOf<T> = T[keyof T];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@d-matrix/utils",
3
3
  "sideEffects": false,
4
- "version": "1.18.0",
4
+ "version": "1.18.1",
5
5
  "description": "A dozen of utils for Front-End Development",
6
6
  "main": "dist/index.js",
7
7
  "scripts": {
package/readme.md CHANGED
@@ -99,7 +99,7 @@ const Test = () => {
99
99
 
100
100
  - `EnhancedComponent.prototype.setStateAsync(state)`
101
101
 
102
- setState 方法的同步版本
102
+ `setState()`方法的同步版本
103
103
 
104
104
  ```ts
105
105
  import { react } from '@d-matrix/utils';
@@ -302,6 +302,24 @@ const t1 = {
302
302
  type T1 = FunctionPropertyNames<typeof t1>; // 'result'
303
303
  ```
304
304
 
305
+ - `ValueOf<T>`
306
+
307
+ 获取对象中`key`的值,返回由这些值组成的union type
308
+
309
+ ```ts
310
+ const map = {
311
+ 0: '0m',
312
+ 1: '1m',
313
+ 2: '2m',
314
+ 3: '3m',
315
+ 4: '4m',
316
+ 5: '5m',
317
+ 6: '6m',
318
+ } as const;
319
+
320
+ type T0 = ValueOf<typeof map>; // '0m' | '1m' | '2m' | '3m' | '4m' | '5m' | '6m'
321
+ ```
322
+
305
323
  ### algorithm
306
324
 
307
325
  - `moveMulti<T extends unknown>(arr: T[], indexes: number[], start: number): T[]`