MCPcopy
hub / github.com/drizzle-team/drizzle-orm / isConfig

Function isConfig

drizzle-orm/src/utils.ts:286–338  ·  view source on GitHub ↗
(data: any)

Source from the content-addressed store, hash-verified

284const __: ExpectedConfigShape = {} as DrizzleConfig;
285
286export function isConfig(data: any): boolean {
287 if (typeof data !== 'object' || data === null) return false;
288
289 if (data.constructor.name !== 'Object') return false;
290
291 if ('logger' in data) {
292 const type = typeof data['logger'];
293 if (
294 type !== 'boolean' && (type !== 'object' || typeof data['logger']['logQuery'] !== 'function')
295 && type !== 'undefined'
296 ) return false;
297
298 return true;
299 }
300
301 if ('schema' in data) {
302 const type = typeof data['schema'];
303 if (type !== 'object' && type !== 'undefined') return false;
304
305 return true;
306 }
307
308 if ('casing' in data) {
309 const type = typeof data['casing'];
310 if (type !== 'string' && type !== 'undefined') return false;
311
312 return true;
313 }
314
315 if ('mode' in data) {
316 if (data['mode'] !== 'default' || data['mode'] !== 'planetscale' || data['mode'] !== undefined) return false;
317
318 return true;
319 }
320
321 if ('connection' in data) {
322 const type = typeof data['connection'];
323 if (type !== 'string' && type !== 'object' && type !== 'undefined') return false;
324
325 return true;
326 }
327
328 if ('client' in data) {
329 const type = typeof data['client'];
330 if (type !== 'object' && type !== 'function' && type !== 'undefined') return false;
331
332 return true;
333 }
334
335 if (Object.keys(data).length === 0) return true;
336
337 return false;
338}
339
340export type NeonAuthToken = string | (() => string | Promise<string>);
341

Callers 15

is-config.test.tsFile · 0.90
drizzleFunction · 0.90
drizzleFunction · 0.90
drizzleFunction · 0.90
drizzleFunction · 0.90
drizzleFunction · 0.90
drizzleFunction · 0.90
drizzleFunction · 0.90
drizzleFunction · 0.90
drizzleFunction · 0.90
drizzleFunction · 0.90
drizzleFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected