swc/bundler/tests/.cache/deno/635cf8b09e7ff6a6ed019da4e7138ffcc79f40d3.ts
강동윤 bbaf619f63
fix(bundler): Fix bugs (#1437)
swc_bundler:
 - [x] Fix wrapped esms. (denoland/deno#9307)
 - [x] Make test secure.
2021-03-02 17:33:03 +09:00

21 lines
508 B
TypeScript

// Loaded from https://deno.land/x/denodb@v1.0.18/lib/helpers/results.ts
import type { ModelSchema } from "../model.ts";
import type { Values } from "../data-types.ts";
/** Transform a plain record object to a given model schema. */
export function formatResultToModelInstance(
Schema: ModelSchema,
fields: Values,
) {
const instance = new Schema();
for (const field in fields) {
(instance as any)[Schema.formatFieldToClient(field) as string] =
fields[field];
}
return instance;
}