mergeArrayByProperty 通过关键属性合并列表数据
mergeArrayByProperty
类型: MethodDeclaration
定义位置: data.ts
描述
通过关键属性合并列表数据
参数
| 参数名 | 类型 | 描述 | 默认值 | 
|---|---|---|---|
| a | Array<any> | - | - | 
| b | Array<any> | - | - | 
| key | string | - | - | 
返回值
类型: void
源代码
位置: 第 294 行
private mergeArrayByProperty(a: Array<any>, b: Array<any>, key: string): void {
    const map: HashMap<boolean> = {}
    for (const item of a) {
      const id = item[key]
      map[id] = true
    }
    for (const item of b) {
      const id = item[key]
      if (id in map) continue
      map[id] = true
      a.push(item)
    }
  }
文档生成时间:2025/7/21 20:53:39