MCPcopy
hub / github.com/nodeWechat/wechat4u / ContactFactory

Function ContactFactory

src/interface/contact.js:105–131  ·  view source on GitHub ↗
(instance)

Source from the content-addressed store, hash-verified

103}
104
105export default function ContactFactory (instance) {
106 return {
107 extend: function (contactObj) {
108 contactObj = Object.setPrototypeOf(contactObj, contactProto)
109 return contactObj.init(instance)
110 },
111 getUserByUserName: function (UserName) {
112 return instance.contacts[UserName]
113 },
114 getSearchUser: function (keyword) {
115 let users = []
116 for (let key in instance.contacts) {
117 if (instance.contacts[key].canSearch(keyword)) {
118 users.push(instance.contacts[key])
119 }
120 }
121 return users
122 },
123 isSelf: function (contact) {
124 return contact.isSelf || contact.UserName === instance.user.UserName
125 },
126 getDisplayName,
127 isRoomContact,
128 isPublicContact,
129 isSpContact
130 }
131}

Callers 2

unit.jsFile · 0.85
constructorMethod · 0.85

Calls 1

initMethod · 0.80

Tested by

no test coverage detected