ShiboSoftwareDev/cc2340r5-reference-design
A CC2340R5 wireless MCU reference board integrating a 2.4 GHz RF matching network and antenna, 48 MHz/optional 32.768 kHz crystals, DC/DC inductors, decoupling capacitors, reset circuitry, power input, and SWD debug connector.
- Version
- 1.4.0
- License
- unset
- Stars
- 0
scripts/shared/props-parser.ts
import Ajv from "ajv"
export function createPropsParser<T>(schema: object) {
const ajv = new Ajv({ useDefaults: true, strictSchema: false, allErrors: true })
const validate = ajv.compile(schema)
return {
parse(input: unknown): T {
const value = structuredClone(input)
if (!validate(value)) throw new Error(ajv.errorsText(validate.errors))
return value as T
},
}
}