@dpkit/core
Version:
Fast TypeScript data management framework built on top of the Data Package standard and Polars DataFrames
19 lines (15 loc) • 520 B
text/typescript
import type { Descriptor } from "../../general/index.ts"
import { denormalizeResource } from "../../resource/index.ts"
import type { Package } from "../Package.ts"
export function denormalizePackage(
dataPackage: Package,
options?: {
basepath?: string
},
) {
dataPackage = globalThis.structuredClone(dataPackage)
const resources = dataPackage.resources.map((resource: any) =>
denormalizeResource(resource, { basepath: options?.basepath }),
)
return { ...dataPackage, resources } as Descriptor
}