15 lines
464 B
JavaScript
15 lines
464 B
JavaScript
import Arbitrary from './arbitrary.js';
|
|
import Base from './base.js';
|
|
import Schema from './schema.js';
|
|
|
|
export default function Component(specificationOrClass) {
|
|
if (specificationOrClass instanceof Base) {
|
|
return specificationOrClass;
|
|
}
|
|
// Why the rigamarole? Maybe we'll implement a flat component for direct binary storage
|
|
// eventually.
|
|
return class AdhocComponent extends Arbitrary {
|
|
static schema = new Schema(specificationOrClass);
|
|
};
|
|
}
|