feat: 增强MapPolyfill,添加entries方法并优化聊天记录调试日志
This commit is contained in:
parent
0d315f4bd7
commit
33b0c1bec1
@ -165,9 +165,9 @@ const getChatHistory = async (
|
||||
[...senders].filter((sender) => !mentions.has(sender))
|
||||
)
|
||||
|
||||
logger.debug(`Mentions: ${JSON.stringify(mentions)}`)
|
||||
logger.debug(`Senders: ${JSON.stringify(senders)}`)
|
||||
logger.debug(`No mention senders: ${JSON.stringify(noMentionSenders)}`)
|
||||
logger.debug(`Mentions: ${JSON.stringify([...mentions.entries()])}`)
|
||||
logger.debug(`Senders: ${JSON.stringify([...senders])}`)
|
||||
logger.debug(`No mention senders: ${JSON.stringify([...noMentionSenders])}`)
|
||||
|
||||
// 从接口获取用户名
|
||||
if (noMentionSenders.size !== 0) {
|
||||
|
@ -69,6 +69,24 @@ class MapPolyfill<K, V> implements MapPolyfillInterface<K, V> {
|
||||
get size(): number {
|
||||
return this.keys.length
|
||||
}
|
||||
|
||||
entries(): IterableIterator<[K, V]> {
|
||||
let index = 0
|
||||
const keys = this.keys
|
||||
const values = this.values
|
||||
return {
|
||||
[Symbol.iterator]() {
|
||||
return this
|
||||
},
|
||||
next(): IteratorResult<[K, V]> {
|
||||
if (index < keys.length) {
|
||||
return { value: [keys[index], values[index++]], done: false }
|
||||
} else {
|
||||
return { value: undefined, done: true }
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default MapPolyfill
|
||||
|
Loading…
x
Reference in New Issue
Block a user