mirror of
https://github.com/Start9Labs/start-sdk.git
synced 2026-03-30 20:24:47 +00:00
chore: Update deps
This commit is contained in:
68
lib/esm/config/list.js
Normal file
68
lib/esm/config/list.js
Normal file
@@ -0,0 +1,68 @@
|
||||
import { IBuilder } from "./builder.js";
|
||||
export class List extends IBuilder {
|
||||
// // deno-lint-ignore ban-types
|
||||
// static boolean<A extends Description & Default<boolean[]> & { range: string; spec: {}; default: boolean }>(a: A) {
|
||||
// return new List({
|
||||
// type: "list" as const,
|
||||
// subtype: "boolean" as const,
|
||||
// ...a,
|
||||
// });
|
||||
// }
|
||||
static string(a) {
|
||||
return new List({
|
||||
type: "list",
|
||||
subtype: "string",
|
||||
...a,
|
||||
});
|
||||
}
|
||||
static number(a) {
|
||||
return new List({
|
||||
type: "list",
|
||||
subtype: "number",
|
||||
...a,
|
||||
});
|
||||
}
|
||||
static enum(a) {
|
||||
return new List({
|
||||
type: "list",
|
||||
subtype: "enum",
|
||||
...a,
|
||||
});
|
||||
}
|
||||
static obj(a) {
|
||||
const { spec: previousSpec, ...rest } = a;
|
||||
const { spec: previousSpecSpec, ...restSpec } = previousSpec;
|
||||
const specSpec = previousSpecSpec.build();
|
||||
const spec = {
|
||||
...restSpec,
|
||||
spec: specSpec,
|
||||
};
|
||||
const value = {
|
||||
spec,
|
||||
...rest,
|
||||
};
|
||||
return new List({
|
||||
type: "list",
|
||||
subtype: "object",
|
||||
...value,
|
||||
});
|
||||
}
|
||||
static union(a) {
|
||||
const { spec: previousSpec, ...rest } = a;
|
||||
const { variants: previousVariants, ...restSpec } = previousSpec;
|
||||
const variants = previousVariants.build();
|
||||
const spec = {
|
||||
...restSpec,
|
||||
variants,
|
||||
};
|
||||
const value = {
|
||||
spec,
|
||||
...rest,
|
||||
};
|
||||
return new List({
|
||||
type: "list",
|
||||
subtype: "union",
|
||||
...value,
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user