MCPcopy
hub / github.com/graphql/graphql-spec / searchUsersByNameExact

Function searchUsersByNameExact

scripts/generate-contributor-list.mjs:188–200  ·  view source on GitHub ↗
(name)

Source from the content-addressed store, hash-verified

186
187// GraphQL user search helpers (users only)
188async function searchUsersByNameExact(name) {
189 if (!TOKEN) return "";
190 const queryStr = `"${name.replace(/"/g, '\\"')}" in:name type:user`;
191 const q = `query($q:String!){ search(type: USER, query: $q, first: 25) { nodes { ... on User { login name } } } }`;
192 const r = await graphql(q, { q: queryStr });
193 const nodes = r?.data?.search?.nodes ?? [];
194 const target = normalizeName(name);
195 for (const it of nodes) {
196 if (!it?.login) continue;
197 if (normalizeName(it.name || "") === target) return it.login;
198 }
199 return "";
200}
201async function searchUsersByLoginToken(token) {
202 if (!TOKEN) return "";
203 const q = `query($q:String!){ search(type: USER, query: $q, first: 5) { nodes { ... on User { login name } } } }`;

Callers 1

workerFunction · 0.85

Calls 2

graphqlFunction · 0.85
normalizeNameFunction · 0.85

Tested by

no test coverage detected