MCPcopy Create free account
hub / github.com/Tencent/kbone / unique

Function unique

packages/miniprogram-render/src/tree/query-selector.js:148–159  ·  view source on GitHub ↗

* 数组去重

(list)

Source from the content-addressed store, hash-verified

146 * 数组去重
147 */
148function unique(list) {
149 for (let i = 0; i < list.length; i++) {
150 const a = list[i]
151
152 for (let j = i + 1; j < list.length; j++) {
153 const b = list[j]
154 if (a === b) list.splice(j, 1)
155 }
156 }
157
158 return list
159}
160
161/**
162 * 将节点按照文档顺序排列

Callers 1

execMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected