(ids)
| 147 | } |
| 148 | |
| 149 | async remove(ids) { |
| 150 | const targetIds = Array.isArray(ids) ? ids : [ids]; |
| 151 | let removed = 0; |
| 152 | for (const idValue of targetIds) { |
| 153 | const id = toId(idValue); |
| 154 | const index = this.idToIndex.get(id); |
| 155 | if (index === undefined) continue; |
| 156 | |
| 157 | const lastIndex = this.size - 1; |
| 158 | if (index !== lastIndex) { |
| 159 | this._moveVector(lastIndex, index); |
| 160 | this.ids[index] = this.ids[lastIndex]; |
| 161 | this.metadata[index] = this.metadata[lastIndex]; |
| 162 | this.idToIndex.set(this.ids[index], index); |
| 163 | } |
| 164 | |
| 165 | this.ids[lastIndex] = undefined; |
| 166 | this.metadata[lastIndex] = undefined; |
| 167 | this.idToIndex.delete(id); |
| 168 | this.size -= 1; |
| 169 | removed += 1; |
| 170 | } |
| 171 | return removed; |
| 172 | } |
| 173 | |
| 174 | async get(ids, options = {}) { |
| 175 | const targetIds = Array.isArray(ids) ? ids : [ids]; |
nothing calls this directly
no test coverage detected