MCPcopy
hub / github.com/mongodb/node-mongodb-native / getIndicesOfAuthInUrl

Function getIndicesOfAuthInUrl

test/tools/utils.ts:216–228  ·  view source on GitHub ↗
(connectionString: string | string[])

Source from the content-addressed store, hash-verified

214export const processTick = () => new Promise(resolve => setTimeout(resolve, 0));
215
216export function getIndicesOfAuthInUrl(connectionString: string | string[]) {
217 const doubleSlashIndex = connectionString.indexOf('//');
218 const atIndex = connectionString.indexOf('@');
219
220 if (doubleSlashIndex === -1 || atIndex === -1) {
221 return null;
222 }
223
224 return {
225 start: doubleSlashIndex + 2,
226 end: atIndex
227 };
228}
229
230export function removeAuthFromConnectionString(connectionString: string) {
231 const indices = getIndicesOfAuthInUrl(connectionString);

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected