@vope/utils 1.4.15 → 1.4.16

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/cjs/index.js CHANGED
@@ -332,15 +332,11 @@ var MemoryBasic = class {
332
332
  push(...list) {
333
333
  const { memorys } = this;
334
334
  list.forEach((data) => {
335
- if (Array.isArray(data)) {
336
- this.push(...data);
337
- } else {
338
- const type = this.getType(data);
339
- const memory = memorys.get(type);
340
- const index = this.list.push(data) - 1;
341
- const result = this.#mount(index, memory);
342
- memory === result || memorys.set(type, result);
343
- }
335
+ const type = this.getType(data);
336
+ const memory = memorys.get(type);
337
+ const index = this.list.push(data) - 1;
338
+ const result = this.#mount(index, memory);
339
+ memory === result || memorys.set(type, result);
344
340
  });
345
341
  return this;
346
342
  }
@@ -506,11 +502,7 @@ var MemorySimple = class {
506
502
  push(...list) {
507
503
  const memory = this.#memory;
508
504
  list.forEach((data) => {
509
- if (Array.isArray(data)) {
510
- this.push(...data);
511
- } else if (!memory.includes(this.#getType(data))) {
512
- memory.push(data);
513
- }
505
+ memory.includes(this.#getType(data)) || memory.push(data);
514
506
  });
515
507
  return this;
516
508
  }
@@ -26,15 +26,11 @@ class MemoryBasic {
26
26
  push(...list) {
27
27
  const { memorys } = this;
28
28
  list.forEach((data) => {
29
- if (Array.isArray(data)) {
30
- this.push(...data);
31
- } else {
32
- const type = this.getType(data);
33
- const memory = memorys.get(type);
34
- const index = this.list.push(data) - 1;
35
- const result = this.#mount(index, memory);
36
- memory === result || memorys.set(type, result);
37
- }
29
+ const type = this.getType(data);
30
+ const memory = memorys.get(type);
31
+ const index = this.list.push(data) - 1;
32
+ const result = this.#mount(index, memory);
33
+ memory === result || memorys.set(type, result);
38
34
  });
39
35
  return this;
40
36
  }
@@ -19,11 +19,7 @@ class MemorySimple {
19
19
  push(...list) {
20
20
  const memory = this.#memory;
21
21
  list.forEach((data) => {
22
- if (Array.isArray(data)) {
23
- this.push(...data);
24
- } else if (!memory.includes(this.#getType(data))) {
25
- memory.push(data);
26
- }
22
+ memory.includes(this.#getType(data)) || memory.push(data);
27
23
  });
28
24
  return this;
29
25
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vope/utils",
3
- "version": "1.4.15",
3
+ "version": "1.4.16",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -12,7 +12,6 @@ interface Config<Reactor> {
12
12
  */
13
13
  reflex(reactor: Reactor): number[];
14
14
  }
15
- export type _LV<T> = (T | _LV<T>)[];
16
15
  /**
17
16
  * 分类存储(通过继承,可用于拓展存储方式)
18
17
  */
@@ -31,7 +30,7 @@ export declare class MemoryBasic<T, Reactor, Type extends Memory.Type> {
31
30
  */
32
31
  constructor(key: Memory.Pitch<T, Type>, config: Config<Reactor>);
33
32
  protected getType(data: T): Type;
34
- push(...list: _LV<T>): this;
33
+ push(...list: T[]): this;
35
34
  /**
36
35
  * 遍历所有存储数据(按入栈顺序)
37
36
  */
@@ -1,5 +1,5 @@
1
1
  import { Assign } from '@vope/types';
2
- import { MemoryBasic, _LV } from './basic';
2
+ import { MemoryBasic } from './basic';
3
3
  import { Memory } from './type';
4
4
  type Transform<T, V> = {
5
5
  [P in keyof T]: T[P] extends (...args: any) => any ? (...args: Parameters<T[P]>) => ReturnType<T[P]> extends T ? V : ReturnType<T[P]> : T[P];
@@ -14,7 +14,7 @@ export declare class MemorySimple<T, Type extends Memory.Type> implements Basic<
14
14
  #private;
15
15
  get size(): number;
16
16
  constructor(key: Memory.Pitch<T, Type>);
17
- push(...list: _LV<T>): this;
17
+ push(...list: T[]): this;
18
18
  /**
19
19
  * 获取指定类型存储数据
20
20
  */