@dpkit/core
Version:
Fast TypeScript data management framework built on top of the Data Package standard and Polars DataFrames
27 lines (20 loc) • 632 B
text/typescript
import type { Descriptor } from "../general/index.ts"
export function normalizeDialect(descriptor: Descriptor) {
descriptor = globalThis.structuredClone(descriptor)
normalizeProfile(descriptor)
normalizeTable(descriptor)
return descriptor
}
function normalizeProfile(descriptor: Descriptor) {
descriptor.$schema = descriptor.$schema ?? descriptor.profile
}
function normalizeTable(descriptor: Descriptor) {
const table = descriptor.table
if (!table) {
return
}
if (typeof table !== "string") {
descriptor.table = undefined
console.warn(`Ignoring v2.0 incompatible dialect table: ${table}`)
}
}