UNPKG

@stringsync/vexml

Version:

MusicXML to Vexflow

34 lines (33 loc) 1.01 kB
/** A class for creating schema types. */ export class t { static defaultConfig(schema) { const config = {}; for (const key in schema) { config[key] = schema[key].defaultValue; } return config; } static string(opts) { const defaultValue = opts.defaultValue; const help = opts.help; return { type: 'string', defaultValue, help }; } static number(opts) { const defaultValue = opts.defaultValue; const help = opts.help; return { type: 'number', defaultValue, help }; } static boolean(opts) { const defaultValue = opts.defaultValue; const help = opts.help; return { type: 'boolean', defaultValue, help }; } static enum(opts) { const defaultValue = opts.defaultValue; const help = opts.help; return { type: 'enum', choices: opts.choices, defaultValue, help }; } constructor() { throw new Error('cannot instantiate t'); } }