Skip to content

Commit

Permalink
frequency
Browse files Browse the repository at this point in the history
  • Loading branch information
Anshgrover23 committed Dec 20, 2024
1 parent b5d5685 commit f2c0231
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 45 deletions.
15 changes: 2 additions & 13 deletions src/source/source_simple_resonator.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
import { source_component_base } from "src/source/base/source_component_base"
import { z } from "zod"
import { parseAndConvertSiUnit } from "src/utils/convert-si-unit-to-number"

const parseFrequency = z.union([z.string(), z.number()]).transform((val) => {
if (typeof val === "string" || typeof val === "number") {
const { value, unitOfValue } = parseAndConvertSiUnit(val)
if (unitOfValue !== "Hz") {
throw new Error(`Invalid frequency unit: ${unitOfValue}`)
}
return value
}
throw new Error("Invalid frequency format")
})
import { frequency } from "src/units"

export const source_simple_resonator = source_component_base.extend({
ftype: z.literal("simple_resonator"),
frequency: parseFrequency,
frequency,
load_capacitance: z.union([z.string(), z.number()]),
pin_count: z.number().default(3), // Set the default pin count to 3 for resonators
})
Expand Down
32 changes: 0 additions & 32 deletions tests/source_simple_resonator.test.ts

This file was deleted.

0 comments on commit f2c0231

Please sign in to comment.