UNPKG

@dpkit/core

Version:

Fast TypeScript data management framework built on top of the Data Package standard and Polars DataFrames

22 lines (19 loc) 559 B
import { AssertionError, type Descriptor } from "../general/index.js" import type { Package } from "./Package.js" import { validatePackageDescriptor } from "./validate.js" /** * Assert a Package descriptor (JSON Object) against its profile */ export async function assertPackage( descriptorOrPackage: Descriptor | Package, options?: { basepath?: string }, ) { const { errors, dataPackage } = await validatePackageDescriptor( descriptorOrPackage, options, ) if (!dataPackage) throw new AssertionError(errors) return dataPackage }